# HG changeset patch # User Matti Hamalainen # Date 1206156244 0 # Node ID df23968f0c6ac0aca474ed71c9c988b7942ea7b9 # Parent 707e35b03f8988cb96ac86db6cf6a318c4fbfdf2 Asdf. diff -r 707e35b03f89 -r df23968f0c6a nnchat.c --- a/nnchat.c Sat Mar 22 02:52:01 2008 +0000 +++ b/nnchat.c Sat Mar 22 03:24:04 2008 +0000 @@ -176,7 +176,7 @@ return ((*buf = th_realloc(*buf, *size + add)) != NULL); } -#define pushChar(x) bufPushChar(&result, &resSize, &resPos, x) +#define PUSHCHAR(x) bufPushChar(&result, &resSize, &resPos, x) BOOL bufPushChar(char **buf, size_t *size, size_t *pos, char ch) { if (*pos >= *size && !bufRealloc(buf, size, SET_ALLOC_SIZE)) @@ -187,7 +187,7 @@ return TRUE; } -#define pushStr(x) bufPushStr(&result, &resSize, &resPos, x) +#define PUSHSTR(x) bufPushStr(&result, &resSize, &resPos, x) BOOL bufPushStr(char **buf, size_t *size, size_t *pos, char *str) { size_t tmpLen; @@ -218,23 +218,23 @@ while (*s) { switch (*s) { case 32: - pushChar('+'); + PUSHCHAR('+'); break; default: if (th_isalnum(*s)) - pushChar(*s); + PUSHCHAR(*s); else { char tmpStr[4]; sprintf(tmpStr, "%2X", (unsigned char) *s); - pushChar('%'); - pushStr(tmpStr); + PUSHCHAR('%'); + PUSHSTR(tmpStr); } break; } s++; } - pushChar(0); + PUSHCHAR(0); return result; } @@ -270,35 +270,35 @@ while (*s) { switch (*s) { case '+': - pushChar(' '); + PUSHCHAR(' '); s++; break; case '%': s++; if (*s == '%') - pushChar('%'); + PUSHCHAR('%'); else if ((c = getxdigit(*s, 4)) >= 0) { int i = getxdigit(*(++s), 0); if (i >= 0) { - pushChar(c | i); + PUSHCHAR(c | i); } else { - pushChar('§'); - pushChar(*s); + PUSHCHAR('§'); + PUSHCHAR(*s); } } else { - pushChar('§'); - pushChar(*s); + PUSHCHAR('§'); + PUSHCHAR(*s); } s++; break; default: - pushChar(*s); + PUSHCHAR(*s); s++; } } - pushChar(0); + PUSHCHAR(0); return result; } @@ -320,9 +320,9 @@ while (*s && *s != '>') s++; if (*s == '>') s++; } else - pushChar(*s++); + PUSHCHAR(*s++); } - pushChar(0); + PUSHCHAR(0); return result; } @@ -365,15 +365,15 @@ BOOL found = FALSE; for (i = 0; i < numHTMLEntities; i++) if (HTMLEntities[i].c == *s) { - pushStr(HTMLEntities[i].ent); + PUSHSTR(HTMLEntities[i].ent); found = TRUE; break; } - if (!found) pushChar(*s); + if (!found) PUSHCHAR(*s); s++; } - pushChar(0); + PUSHCHAR(0); return result; } @@ -398,17 +398,17 @@ html_entity_t *ent = &HTMLEntities[i]; int len = strlen(ent->ent); if (!strncmp(s, ent->ent, len)) { - pushChar(ent->c); + PUSHCHAR(ent->c); s += len; found = TRUE; break; } } - if (!found) pushChar(*s++); + if (!found) PUSHCHAR(*s++); } else - pushChar(*s++); + PUSHCHAR(*s++); } - pushChar(0); + PUSHCHAR(0); return result; }