Some small fixes
Andreas Jaeger
aj@suse.de
Mon Feb 28 00:14:00 GMT 2000
>>>>> Ulrich Drepper writes:
Ulrich> Andreas Jaeger <aj@suse.de> writes:
[..]
>> For this code (p and start are pointers):
>> printf ("%d:\t", p - start);
>>
>> We could use either %ld or %t here - or cast the result to an int.
>> What's the best way to fix this?
Ulrich> I would suggest to use %t protected by #ifdef _LIBC (similar to what
Ulrich> already happens for %p).
Here's a patch - but now we get different warnings since gcc doesn't
understand %t and %z :-(. I hope gcc gets fixed soon.
Andreas
2000-02-28 Andreas Jaeger <aj@suse.de>
* posix/regex.c (print_partial_compiled_pattern): Use correct
format modifiers.
(print_compiled_pattern): Likewise.
============================================================
Index: posix/regex.c
--- posix/regex.c 2000/02/25 17:05:59 1.69
+++ posix/regex.c 2000/02/28 07:36:44
@@ -683,8 +683,12 @@
/* Loop over pattern commands. */
while (p < pend)
{
+#ifdef _LIBC
+ printf ("%t:\t", p - start);
+#else
printf ("%d:\t", p - start);
-
+#endif
+
switch ((re_opcode_t) *p++)
{
case no_op:
@@ -773,17 +777,29 @@
case on_failure_jump:
extract_number_and_incr (&mcnt, &p);
+#ifdef _LIBC
+ printf ("/on_failure_jump to %t", p + mcnt - start);
+#else
printf ("/on_failure_jump to %d", p + mcnt - start);
+#endif
break;
case on_failure_keep_string_jump:
extract_number_and_incr (&mcnt, &p);
+#ifdef _LIBC
+ printf ("/on_failure_keep_string_jump to %t", p + mcnt - start);
+#else
printf ("/on_failure_keep_string_jump to %d", p + mcnt - start);
+#endif
break;
case dummy_failure_jump:
extract_number_and_incr (&mcnt, &p);
+#ifdef _LIBC
+ printf ("/dummy_failure_jump to %t", p + mcnt - start);
+#else
printf ("/dummy_failure_jump to %d", p + mcnt - start);
+#endif
break;
case push_dummy_failure:
@@ -792,43 +808,71 @@
case maybe_pop_jump:
extract_number_and_incr (&mcnt, &p);
+#ifdef _LIBC
+ printf ("/maybe_pop_jump to %t", p + mcnt - start);
+#else
printf ("/maybe_pop_jump to %d", p + mcnt - start);
+#endif
break;
case pop_failure_jump:
extract_number_and_incr (&mcnt, &p);
+#ifdef _LIBC
+ printf ("/pop_failure_jump to %t", p + mcnt - start);
+#else
printf ("/pop_failure_jump to %d", p + mcnt - start);
+#endif
break;
case jump_past_alt:
extract_number_and_incr (&mcnt, &p);
+#ifdef _LIBC
+ printf ("/jump_past_alt to %t", p + mcnt - start);
+#else
printf ("/jump_past_alt to %d", p + mcnt - start);
+#endif
break;
case jump:
extract_number_and_incr (&mcnt, &p);
+#ifdef _LIBC
+ printf ("/jump to %t", p + mcnt - start);
+#else
printf ("/jump to %d", p + mcnt - start);
+#endif
break;
case succeed_n:
extract_number_and_incr (&mcnt, &p);
p1 = p + mcnt;
extract_number_and_incr (&mcnt2, &p);
+#ifdef _LIBC
+ printf ("/succeed_n to %t, %d times", p1 - start, mcnt2);
+#else
printf ("/succeed_n to %d, %d times", p1 - start, mcnt2);
+#endif
break;
case jump_n:
extract_number_and_incr (&mcnt, &p);
p1 = p + mcnt;
extract_number_and_incr (&mcnt2, &p);
+#ifdef _LIBC
+ printf ("/jump_n to %t, %d times", p1 - start, mcnt2);
+#else
printf ("/jump_n to %d, %d times", p1 - start, mcnt2);
+#endif
break;
case set_number_at:
extract_number_and_incr (&mcnt, &p);
p1 = p + mcnt;
extract_number_and_incr (&mcnt2, &p);
+#ifdef _LIBC
+ printf ("/set_number_at location %t to %d", p1 - start, mcnt2);
+#else
printf ("/set_number_at location %d to %d", p1 - start, mcnt2);
+#endif
break;
case wordbound:
@@ -895,7 +939,11 @@
putchar ('\n');
}
+#ifdef _LIBC
+ printf ("%t:\tend of pattern.\n", p - start);
+#else
printf ("%d:\tend of pattern.\n", p - start);
+#endif
}
@@ -914,8 +962,11 @@
printf ("fastmap: ");
print_fastmap (bufp->fastmap);
}
-
+#ifdef _LIBC
+ printf ("re_nsub: %z\t", bufp->re_nsub);
+#else
printf ("re_nsub: %d\t", bufp->re_nsub);
+#endif
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);
--
Andreas Jaeger
SuSE Labs aj@suse.de
private aj@arthur.rhein-neckar.de
More information about the Libc-hacker
mailing list