Mercurial > hg > xemacs-beta
diff src/regex.c @ 5934:e2fae7783046 cygwin
lots of use of EMACS_INT, a few others, to eliminate all pointer truncation warnings
author | Henry Thompson <ht@markup.co.uk> |
---|---|
date | Sat, 12 Dec 2015 19:08:46 +0000 |
parents | 8a2ac78cb97d |
children | 574f0cded429 |
line wrap: on
line diff
--- a/src/regex.c Thu Dec 10 17:55:59 2015 +0000 +++ b/src/regex.c Sat Dec 12 19:08:46 2015 +0000 @@ -820,7 +820,7 @@ /* Loop over pattern commands. */ while (p < pend) { - printf ("%ld:\t", (long)(p - start)); + printf ("%Id:\t", (EMACS_INT)(p - start)); switch ((re_opcode_t) *p++) { @@ -919,14 +919,14 @@ if (first < 0x80) putchar (first); else - printf ("(0x%lx)", (long)first); + printf ("(0x%Ix)", (EMACS_INT)first); if (first != last) { putchar ('-'); if (last < 0x80) putchar (last); else - printf ("(0x%lx)", (long)last); + printf ("(0x%Ix)", (EMACS_INT)last); } } putchar (']'); @@ -945,17 +945,17 @@ case on_failure_jump: extract_number_and_incr (&mcnt, &p); - printf ("/on_failure_jump to %ld", (long)(p + mcnt - start)); + printf ("/on_failure_jump to %Id", (EMACS_INT)(p + mcnt - start)); break; case on_failure_keep_string_jump: extract_number_and_incr (&mcnt, &p); - printf ("/on_failure_keep_string_jump to %ld", (long)(p + mcnt - start)); + printf ("/on_failure_keep_string_jump to %Id", (EMACS_INT)(p + mcnt - start)); break; case dummy_failure_jump: extract_number_and_incr (&mcnt, &p); - printf ("/dummy_failure_jump to %ld", (long)(p + mcnt - start)); + printf ("/dummy_failure_jump to %Id", (EMACS_INT)(p + mcnt - start)); break; case push_dummy_failure: @@ -964,40 +964,40 @@ case maybe_pop_jump: extract_number_and_incr (&mcnt, &p); - printf ("/maybe_pop_jump to %ld", (long)(p + mcnt - start)); + printf ("/maybe_pop_jump to %Id", (EMACS_INT)(p + mcnt - start)); break; case pop_failure_jump: extract_number_and_incr (&mcnt, &p); - printf ("/pop_failure_jump to %ld", (long)(p + mcnt - start)); + printf ("/pop_failure_jump to %Id", (EMACS_INT)(p + mcnt - start)); break; case jump_past_alt: extract_number_and_incr (&mcnt, &p); - printf ("/jump_past_alt to %ld", (long)(p + mcnt - start)); + printf ("/jump_past_alt to %Id", (EMACS_INT)(p + mcnt - start)); break; case jump: extract_number_and_incr (&mcnt, &p); - printf ("/jump to %ld", (long)(p + mcnt - start)); + printf ("/jump to %Id", (EMACS_INT)(p + mcnt - start)); break; case succeed_n: extract_number_and_incr (&mcnt, &p); extract_number_and_incr (&mcnt2, &p); - printf ("/succeed_n to %ld, %d times", (long)(p + mcnt - start), mcnt2); + printf ("/succeed_n to %Id, %d times", (EMACS_INT)(p + mcnt - start), mcnt2); break; case jump_n: extract_number_and_incr (&mcnt, &p); extract_number_and_incr (&mcnt2, &p); - printf ("/jump_n to %ld, %d times", (long)(p + mcnt - start), mcnt2); + printf ("/jump_n to %Id, %d times", (EMACS_INT)(p + mcnt - start), mcnt2); break; case set_number_at: extract_number_and_incr (&mcnt, &p); extract_number_and_incr (&mcnt2, &p); - printf ("/set_number_at location %ld to %d", (long)(p + mcnt - start), mcnt2); + printf ("/set_number_at location %Id to %d", (EMACS_INT)(p + mcnt - start), mcnt2); break; case wordbound: @@ -1080,7 +1080,7 @@ putchar ('\n'); } - printf ("%ld:\tend of pattern.\n", (long)(p - start)); + printf ("%Id:\tend of pattern.\n", (EMACS_INT)(p - start)); } @@ -1099,8 +1099,8 @@ print_fastmap (bufp->fastmap); } - printf ("re_nsub: %ld\t", (long)bufp->re_nsub); - printf ("re_ngroups: %ld\t", (long)bufp->re_ngroups); + printf ("re_nsub: %Id\t", (EMACS_INT)bufp->re_nsub); + printf ("re_ngroups: %Id\t", (EMACS_INT)bufp->re_ngroups); printf ("regs_alloc: %d\t", bufp->regs_allocated); printf ("can_be_null: %d\t", bufp->can_be_null); printf ("newline_anchor: %d\n", bufp->newline_anchor); @@ -1564,14 +1564,14 @@ DEBUG_STATEMENT (failure_id++); \ DEBUG_STATEMENT (nfailure_points_pushed++); \ DEBUG_FAIL_PRINT2 ("\nPUSH_FAILURE_POINT #%d:\n", failure_id); \ - DEBUG_FAIL_PRINT2 (" Before push, next avail: %ld\n", \ - (long) (fail_stack).avail); \ - DEBUG_FAIL_PRINT2 (" size: %ld\n", \ - (long) (fail_stack).size); \ + DEBUG_FAIL_PRINT2 (" Before push, next avail: %Id\n", \ + (EMACS_INT) (fail_stack).avail); \ + DEBUG_FAIL_PRINT2 (" size: %Id\n", \ + (EMACS_INT) (fail_stack).size); \ \ DEBUG_FAIL_PRINT2 (" slots needed: %d\n", NUM_FAILURE_ITEMS); \ - DEBUG_FAIL_PRINT2 (" available: %ld\n", \ - (long) REMAINING_AVAIL_SLOTS); \ + DEBUG_FAIL_PRINT2 (" available: %Id\n", \ + (EMACS_INT) REMAINING_AVAIL_SLOTS); \ \ /* Ensure we have enough space allocated for what we will push. */ \ while (REMAINING_AVAIL_SLOTS < NUM_FAILURE_ITEMS) \ @@ -1584,10 +1584,10 @@ return failure_code; \ } \ END_REGEX_MALLOC_OK (); \ - DEBUG_FAIL_PRINT2 ("\n Doubled stack; size now: %ld\n", \ - (long) (fail_stack).size); \ - DEBUG_FAIL_PRINT2 (" slots available: %ld\n", \ - (long) REMAINING_AVAIL_SLOTS); \ + DEBUG_FAIL_PRINT2 ("\n Doubled stack; size now: %Id\n", \ + (EMACS_INT) (fail_stack).size); \ + DEBUG_FAIL_PRINT2 (" slots available: %Id\n", \ + (EMACS_INT) REMAINING_AVAIL_SLOTS); \ \ RE_MATCH_RELOCATE_MOVEABLE_DATA_POINTERS (); \ } \ @@ -1601,10 +1601,10 @@ DEBUG_FAIL_PRINT2 (" Pushing reg: %d\n", this_reg); \ DEBUG_STATEMENT (num_regs_pushed++); \ \ - DEBUG_FAIL_PRINT2 (" start: 0x%lx\n", (long) regstart[this_reg]); \ + DEBUG_FAIL_PRINT2 (" start: 0x%Ix\n", (EMACS_INT) regstart[this_reg]); \ PUSH_FAILURE_POINTER (regstart[this_reg]); \ \ - DEBUG_FAIL_PRINT2 (" end: 0x%lx\n", (long) regend[this_reg]); \ + DEBUG_FAIL_PRINT2 (" end: 0x%Ix\n", (EMACS_INT) regend[this_reg]); \ PUSH_FAILURE_POINTER (regend[this_reg]); \ \ DEBUG_FAIL_PRINT2 (" info: 0x%lx\n ", \ @@ -1626,11 +1626,11 @@ DEBUG_FAIL_PRINT2 (" Pushing high active reg: %d\n", highest_active_reg); \ PUSH_FAILURE_INT (highest_active_reg); \ \ - DEBUG_FAIL_PRINT2 (" Pushing pattern 0x%lx: \n", (long) pattern_place); \ + DEBUG_FAIL_PRINT2 (" Pushing pattern 0x%Ix: \n", (EMACS_INT) pattern_place); \ DEBUG_FAIL_PRINT_COMPILED_PATTERN (bufp, pattern_place, pend); \ PUSH_FAILURE_POINTER (pattern_place); \ \ - DEBUG_FAIL_PRINT2 (" Pushing string 0x%lx: `", (long) string_place); \ + DEBUG_FAIL_PRINT2 (" Pushing string 0x%Ix: `", (EMACS_INT) string_place); \ DEBUG_FAIL_PRINT_DOUBLE_STRING (string_place, string1, size1, string2, \ size2); \ DEBUG_FAIL_PRINT1 ("'\n"); \ @@ -1689,10 +1689,10 @@ \ /* Remove failure points and point to how many regs pushed. */ \ DEBUG_FAIL_PRINT1 ("POP_FAILURE_POINT:\n"); \ - DEBUG_FAIL_PRINT2 (" Before pop, next avail: %ld\n", \ - (long) fail_stack.avail); \ - DEBUG_FAIL_PRINT2 (" size: %ld\n", \ - (long) fail_stack.size); \ + DEBUG_FAIL_PRINT2 (" Before pop, next avail: %Id\n", \ + (EMACS_INT) fail_stack.avail); \ + DEBUG_FAIL_PRINT2 (" size: %Id\n", \ + (EMACS_INT) fail_stack.size); \ \ assert (fail_stack.avail >= NUM_NONREG_ITEMS); \ \ @@ -1707,12 +1707,12 @@ if (string_temp != NULL) \ str = string_temp; \ \ - DEBUG_FAIL_PRINT2 (" Popping string 0x%lx: `", (long) str); \ + DEBUG_FAIL_PRINT2 (" Popping string 0x%Ix: `", (EMACS_INT) str); \ DEBUG_FAIL_PRINT_DOUBLE_STRING (str, string1, size1, string2, size2); \ DEBUG_FAIL_PRINT1 ("'\n"); \ \ pat = (unsigned char *) POP_FAILURE_POINTER (); \ - DEBUG_FAIL_PRINT2 (" Popping pattern 0x%lx: ", (long) pat); \ + DEBUG_FAIL_PRINT2 (" Popping pattern 0x%Ix: ", (EMACS_INT) pat); \ DEBUG_FAIL_PRINT_COMPILED_PATTERN (bufp, pat, pend); \ \ /* Restore register info. */ \ @@ -1731,10 +1731,10 @@ * (long *) ®_info[this_reg]); \ \ regend[this_reg] = POP_FAILURE_POINTER (); \ - DEBUG_FAIL_PRINT2 (" end: 0x%lx\n", (long) regend[this_reg]); \ + DEBUG_FAIL_PRINT2 (" end: 0x%Ix\n", (EMACS_INT) regend[this_reg]); \ \ regstart[this_reg] = POP_FAILURE_POINTER (); \ - DEBUG_FAIL_PRINT2 (" start: 0x%lx\n", (long) regstart[this_reg]); \ + DEBUG_FAIL_PRINT2 (" start: 0x%Ix\n", (EMACS_INT) regstart[this_reg]); \ } \ \ set_regs_matched_done = 0; \ @@ -5351,7 +5351,7 @@ fails at this starting point in the input data. */ for (;;) { - DEBUG_MATCH_PRINT2 ("\n0x%lx: ", (long) p); + DEBUG_MATCH_PRINT2 ("\n0x%Ix: ", (EMACS_UINT) p); #ifdef emacs /* XEmacs added, w/removal of immediate_quit */ if (!no_quit_in_re_search) { @@ -6068,7 +6068,7 @@ DEBUG_MATCH_PRINT1 ("EXECUTING on_failure_keep_string_jump"); EXTRACT_NUMBER_AND_INCR (mcnt, p); - DEBUG_MATCH_PRINT3 (" %d (to 0x%lx):\n", mcnt, (long) (p + mcnt)); + DEBUG_MATCH_PRINT3 (" %d (to 0x%Ix):\n", mcnt, (EMACS_INT) (p + mcnt)); PUSH_FAILURE_POINT (p + mcnt, (unsigned char *) 0, -2); break; @@ -6091,7 +6091,7 @@ DEBUG_MATCH_PRINT1 ("EXECUTING on_failure_jump"); EXTRACT_NUMBER_AND_INCR (mcnt, p); - DEBUG_MATCH_PRINT3 (" %d (to 0x%lx)", mcnt, (long) (p + mcnt)); + DEBUG_MATCH_PRINT3 (" %d (to 0x%Ix)", mcnt, (EMACS_INT) (p + mcnt)); /* If this on_failure_jump comes right before a group (i.e., the original * applied to a group), save the information @@ -6306,7 +6306,7 @@ EXTRACT_NUMBER_AND_INCR (mcnt, p); /* Get the amount to jump. */ DEBUG_MATCH_PRINT2 ("EXECUTING jump %d ", mcnt); p += mcnt; /* Do the jump. */ - DEBUG_MATCH_PRINT2 ("(to 0x%lx).\n", (long) p); + DEBUG_MATCH_PRINT2 ("(to 0x%Ix).\n", (EMACS_INT) p); break; @@ -6355,12 +6355,12 @@ mcnt--; p += 2; STORE_NUMBER_AND_INCR (p, mcnt); - DEBUG_MATCH_PRINT3 (" Setting 0x%lx to %d.\n", (long) p, mcnt); + DEBUG_MATCH_PRINT3 (" Setting 0x%Ix to %d.\n", (EMACS_INT) p, mcnt); } else if (mcnt == 0) { - DEBUG_MATCH_PRINT2 (" Setting two bytes from 0x%lx to no_op.\n", - (long) (p+2)); + DEBUG_MATCH_PRINT2 (" Setting two bytes from 0x%Ix to no_op.\n", + (EMACS_INT) (p+2)); p[2] = (unsigned char) no_op; p[3] = (unsigned char) no_op; goto on_failure; @@ -6390,7 +6390,7 @@ EXTRACT_NUMBER_AND_INCR (mcnt, p); p1 = p + mcnt; EXTRACT_NUMBER_AND_INCR (mcnt, p); - DEBUG_MATCH_PRINT3 (" Setting 0x%lx to %d.\n", (long) p1, mcnt); + DEBUG_MATCH_PRINT3 (" Setting 0x%Ix to %d.\n", (EMACS_INT) p1, mcnt); STORE_NUMBER (p1, mcnt); break; }