aboutsummaryrefslogtreecommitdiffstats
path: root/src/search.c
diff options
context:
space:
mode:
authorVibhav Pant2020-08-21 14:04:35 +0530
committerVibhav Pant2020-08-21 14:04:35 +0530
commitf0f8d7b82492e741950c363a03b886965c91b1b0 (patch)
tree19b716830b1ebabc0d7d75949c4e6800c0f104ad /src/search.c
parent9e64a087c4d167e7ec1c4e22bea3e6af53b563de (diff)
parentc818c29771d3cb51875643b2f6c894073e429dd2 (diff)
downloademacs-feature/native-comp-macos-fixes.tar.gz
emacs-feature/native-comp-macos-fixes.zip
Merge branch 'feature/native-comp' into feature/native-comp-macos-fixesfeature/native-comp-macos-fixes
Diffstat (limited to 'src/search.c')
-rw-r--r--src/search.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/search.c b/src/search.c
index 38c64caf7c0..6fb3716cd43 100644
--- a/src/search.c
+++ b/src/search.c
@@ -3271,7 +3271,7 @@ the buffer. If the buffer doesn't have a cache, the value is nil. */)
3271 TYPE_MAXIMUM (ptrdiff_t), &nl_count_cache, NULL, true); 3271 TYPE_MAXIMUM (ptrdiff_t), &nl_count_cache, NULL, true);
3272 3272
3273 /* Create vector and populate it. */ 3273 /* Create vector and populate it. */
3274 cache_newlines = make_uninit_vector (nl_count_cache); 3274 cache_newlines = make_vector (nl_count_cache, make_fixnum (-1));
3275 3275
3276 if (nl_count_cache) 3276 if (nl_count_cache)
3277 { 3277 {
@@ -3285,15 +3285,12 @@ the buffer. If the buffer doesn't have a cache, the value is nil. */)
3285 break; 3285 break;
3286 ASET (cache_newlines, i, make_fixnum (found - 1)); 3286 ASET (cache_newlines, i, make_fixnum (found - 1));
3287 } 3287 }
3288 /* Fill the rest of slots with an invalid position. */
3289 for ( ; i < nl_count_cache; i++)
3290 ASET (cache_newlines, i, make_fixnum (-1));
3291 } 3288 }
3292 3289
3293 /* Now do the same, but without using the cache. */ 3290 /* Now do the same, but without using the cache. */
3294 find_newline1 (BEGV, BEGV_BYTE, ZV, ZV_BYTE, 3291 find_newline1 (BEGV, BEGV_BYTE, ZV, ZV_BYTE,
3295 TYPE_MAXIMUM (ptrdiff_t), &nl_count_buf, NULL, true); 3292 TYPE_MAXIMUM (ptrdiff_t), &nl_count_buf, NULL, true);
3296 buf_newlines = make_uninit_vector (nl_count_buf); 3293 buf_newlines = make_vector (nl_count_buf, make_fixnum (-1));
3297 if (nl_count_buf) 3294 if (nl_count_buf)
3298 { 3295 {
3299 for (from = BEGV, found = from, i = 0; from < ZV; from = found, i++) 3296 for (from = BEGV, found = from, i = 0; from < ZV; from = found, i++)
@@ -3306,14 +3303,10 @@ the buffer. If the buffer doesn't have a cache, the value is nil. */)
3306 break; 3303 break;
3307 ASET (buf_newlines, i, make_fixnum (found - 1)); 3304 ASET (buf_newlines, i, make_fixnum (found - 1));
3308 } 3305 }
3309 for ( ; i < nl_count_buf; i++)
3310 ASET (buf_newlines, i, make_fixnum (-1));
3311 } 3306 }
3312 3307
3313 /* Construct the value and return it. */ 3308 /* Construct the value and return it. */
3314 val = make_uninit_vector (2); 3309 val = CALLN (Fvector, cache_newlines, buf_newlines);
3315 ASET (val, 0, cache_newlines);
3316 ASET (val, 1, buf_newlines);
3317 3310
3318 if (old != NULL) 3311 if (old != NULL)
3319 set_buffer_internal_1 (old); 3312 set_buffer_internal_1 (old);