Commit add2372d authored by Pekka Pessi's avatar Pekka Pessi
Browse files

Cleaned up debug printing in su_memmem.c.

darcs-hash:20051128221935-65a35-09673636856ac93830637775576439da8ed02f05.gz
parent 6603c523
...@@ -112,7 +112,8 @@ bm_memmem(char const *haystack, size_t hlen, ...@@ -112,7 +112,8 @@ bm_memmem(char const *haystack, size_t hlen,
unsigned char h = haystack[i]; unsigned char h = haystack[i];
if (h == needle[j]) { if (h == needle[j]) {
TORTURELOG(("match \"%s\" at %u\nwith %*s\"%.*s*%s\": %s\n", TORTURELOG(("match \"%s\" at %u\nwith %*s\"%.*s*%s\": %s\n",
haystack, i, i - j, "", j, needle, needle + j + 1, haystack, (unsigned)i,
(int)(i - j), "", (int)j, needle, needle + j + 1,
j == 0 ? "match!" : "back by 1")); j == 0 ? "match!" : "back by 1"));
if (j == 0) if (j == 0)
return haystack + i; return haystack + i;
...@@ -121,14 +122,18 @@ bm_memmem(char const *haystack, size_t hlen, ...@@ -121,14 +122,18 @@ bm_memmem(char const *haystack, size_t hlen,
else { else {
if (fwd->table[h] > nlen - j) { if (fwd->table[h] > nlen - j) {
TORTURELOG(("match \"%s\" at %u\n" TORTURELOG(("match \"%s\" at %u\n"
"last %*s\"%.*s*%s\": (by %u)\n", haystack, i, "last %*s\"%.*s*%s\": (by %u)\n",
i - j, "", j, needle, needle + j + 1, fwd->table[h])); haystack, (unsigned)i,
(int)(i - j), "",
(int)j, needle, needle + j + 1, fwd->table[h]));
i += fwd->table[h]; i += fwd->table[h];
} }
else { else {
TORTURELOG(("match \"%s\" at %u\n" TORTURELOG(("match \"%s\" at %u\n"
"2nd %*s\"%.*s*%s\": (by %u)\n", haystack, i, "2nd %*s\"%.*s*%s\": (by %u)\n",
i - j, "", j, needle, needle + j + 1, nlen - j)); haystack, (unsigned)i,
(int)(i - j), "",
(int)j, needle, needle + j + 1, (unsigned)(nlen - j)));
i += nlen - j; i += nlen - j;
} }
j = nlen - 1; j = nlen - 1;
...@@ -208,8 +213,9 @@ bm_memcasemem(char const *haystack, size_t hlen, ...@@ -208,8 +213,9 @@ bm_memcasemem(char const *haystack, size_t hlen,
if (h == n) { if (h == n) {
TORTURELOG(("match \"%s\" at %u\n" TORTURELOG(("match \"%s\" at %u\n"
"with %*s\"%.*s*%s\": %s\n", haystack, i, "with %*s\"%.*s*%s\": %s\n",
i - j, "", j, needle, needle + j + 1, haystack, (unsigned)i,
(int)(i - j), "", (int)j, needle, needle + j + 1,
j == 0 ? "match!" : "back by 1")); j == 0 ? "match!" : "back by 1"));
if (j == 0) if (j == 0)
return haystack + i; return haystack + i;
...@@ -218,14 +224,18 @@ bm_memcasemem(char const *haystack, size_t hlen, ...@@ -218,14 +224,18 @@ bm_memcasemem(char const *haystack, size_t hlen,
else { else {
if (fwd->table[h] > nlen - j) { if (fwd->table[h] > nlen - j) {
TORTURELOG(("match \"%s\" at %u\n" TORTURELOG(("match \"%s\" at %u\n"
"last %*s\"%.*s*%s\": (by %u)\n", haystack, i, "last %*s\"%.*s*%s\": (by %u)\n",
i - j, "", j, needle, needle + j + 1, fwd->table[h])); haystack, (unsigned)i,
(int)(i - j), "", (int)j, needle, needle + j + 1,
fwd->table[h]));
i += fwd->table[h]; i += fwd->table[h];
} }
else { else {
TORTURELOG(("match \"%s\" at %u\n" TORTURELOG(("match \"%s\" at %u\n"
"2nd %*s\"%.*s*%s\": (by %u)\n", haystack, i, "2nd %*s\"%.*s*%s\": (by %u)\n",
i - j, "", j, needle, needle + j + 1, nlen - j)); haystack, (unsigned)i,
(int)(i - j), "", (int)j, needle, needle + j + 1,
(unsigned)(nlen - j)));
i += nlen - j; i += nlen - j;
} }
j = nlen - 1; j = nlen - 1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment