- char *s = "**** debug string overflowed buffer ****\n";
- char *p = buffer + (int)strlen(buffer);
- int maxlen = sizeof(buffer) - (int)strlen(s) - 3;
- if (p > buffer + maxlen) p = buffer + maxlen;
- if (p > buffer && p[-1] != '\n') *p++ = '\n';
+ char * s = "**** debug string overflowed buffer ****\n";
+ char * p = CS g->s + g->ptr;
+ int maxlen = g->size - (int)strlen(s) - 3;
+ if (p > g->s + maxlen) p = g->s + maxlen;
+ if (p > g->s && p[-1] != '\n') *p++ = '\n';