aboutsummaryrefslogtreecommitdiffstats
path: root/src/syntax.c
diff options
context:
space:
mode:
authorStefan Monnier2019-03-01 16:04:11 -0500
committerStefan Monnier2019-03-01 16:04:11 -0500
commit2028756fa3db8dc266c0abbf4ecb672ab5348e71 (patch)
tree11149a3a4a558c359679a799cce6d59ba498621b /src/syntax.c
parent0c834e9234a582933235080f6b98fe1c874d7dde (diff)
downloademacs-2028756fa3db8dc266c0abbf4ecb672ab5348e71.tar.gz
emacs-2028756fa3db8dc266c0abbf4ecb672ab5348e71.zip
* src/syntax.c (update_syntax_table): Prefer 'else' to 'goto'
Diffstat (limited to 'src/syntax.c')
-rw-r--r--src/syntax.c67
1 files changed, 34 insertions, 33 deletions
diff --git a/src/syntax.c b/src/syntax.c
index fe1e2d236b9..32103c8657c 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -309,7 +309,7 @@ SETUP_SYNTAX_TABLE_FOR_OBJECT (Lisp_Object object,
309} 309}
310 310
311/* Update gl_state to an appropriate interval which contains CHARPOS. The 311/* Update gl_state to an appropriate interval which contains CHARPOS. The
312 sign of COUNT give the relative position of CHARPOS wrt the previously 312 sign of COUNT gives the relative position of CHARPOS wrt the previously
313 valid interval. If INIT, only [be]_property fields of gl_state are 313 valid interval. If INIT, only [be]_property fields of gl_state are
314 valid at start, the rest is filled basing on OBJECT. 314 valid at start, the rest is filled basing on OBJECT.
315 315
@@ -343,42 +343,43 @@ update_syntax_table (ptrdiff_t charpos, EMACS_INT count, bool init,
343 i = gl_state.forward_i; 343 i = gl_state.forward_i;
344 gl_state.b_property = i->position - gl_state.offset; 344 gl_state.b_property = i->position - gl_state.offset;
345 gl_state.e_property = INTERVAL_LAST_POS (i) - gl_state.offset; 345 gl_state.e_property = INTERVAL_LAST_POS (i) - gl_state.offset;
346 goto update;
347 } 346 }
348 i = count > 0 ? gl_state.forward_i : gl_state.backward_i; 347 else
349
350 /* We are guaranteed to be called with CHARPOS either in i,
351 or further off. */
352 if (!i)
353 error ("Error in syntax_table logic for to-the-end intervals");
354 else if (charpos < i->position) /* Move left. */
355 {
356 if (count > 0)
357 error ("Error in syntax_table logic for intervals <-");
358 /* Update the interval. */
359 i = update_interval (i, charpos);
360 if (INTERVAL_LAST_POS (i) != gl_state.b_property)
361 {
362 invalidate = false;
363 gl_state.forward_i = i;
364 gl_state.e_property = INTERVAL_LAST_POS (i) - gl_state.offset;
365 }
366 }
367 else if (charpos >= INTERVAL_LAST_POS (i)) /* Move right. */
368 { 348 {
369 if (count < 0) 349 i = count > 0 ? gl_state.forward_i : gl_state.backward_i;
370 error ("Error in syntax_table logic for intervals ->"); 350
371 /* Update the interval. */ 351 /* We are guaranteed to be called with CHARPOS either in i,
372 i = update_interval (i, charpos); 352 or further off. */
373 if (i->position != gl_state.e_property) 353 if (!i)
374 { 354 error ("Error in syntax_table logic for to-the-end intervals");
375 invalidate = false; 355 else if (charpos < i->position) /* Move left. */
376 gl_state.backward_i = i; 356 {
377 gl_state.b_property = i->position - gl_state.offset; 357 if (count > 0)
378 } 358 error ("Error in syntax_table logic for intervals <-");
359 /* Update the interval. */
360 i = update_interval (i, charpos);
361 if (INTERVAL_LAST_POS (i) != gl_state.b_property)
362 {
363 invalidate = false;
364 gl_state.forward_i = i;
365 gl_state.e_property = INTERVAL_LAST_POS (i) - gl_state.offset;
366 }
367 }
368 else if (charpos >= INTERVAL_LAST_POS (i)) /* Move right. */
369 {
370 if (count < 0)
371 error ("Error in syntax_table logic for intervals ->");
372 /* Update the interval. */
373 i = update_interval (i, charpos);
374 if (i->position != gl_state.e_property)
375 {
376 invalidate = false;
377 gl_state.backward_i = i;
378 gl_state.b_property = i->position - gl_state.offset;
379 }
380 }
379 } 381 }
380 382
381 update:
382 tmp_table = textget (i->plist, Qsyntax_table); 383 tmp_table = textget (i->plist, Qsyntax_table);
383 384
384 if (invalidate) 385 if (invalidate)