Mercurial > hg > nnchat
comparison libnnchat.c @ 79:e36df57c5b0f
Use th_strdup() again.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 24 Dec 2008 16:03:53 +0200 |
parents | 745f670068dc |
children | c2d916b340bf |
comparison
equal
deleted
inserted
replaced
78:745f670068dc | 79:e36df57c5b0f |
---|---|
390 | 390 |
391 | 391 |
392 void addRingBuf(ringbuf_t *buf, const char *str) | 392 void addRingBuf(ringbuf_t *buf, const char *str) |
393 { | 393 { |
394 if (buf->n < buf->size) { | 394 if (buf->n < buf->size) { |
395 buf->data[buf->n] = strdup(str); | 395 buf->data[buf->n] = th_strdup(str); |
396 buf->n++; | 396 buf->n++; |
397 } else { | 397 } else { |
398 th_free(buf->data[0]); | 398 th_free(buf->data[0]); |
399 memmove(&(buf->data[0]), &(buf->data[1]), buf->size - 1); | 399 memmove(&(buf->data[0]), &(buf->data[1]), buf->size - 1); |
400 buf->data[buf->size - 1] = strdup(str); | 400 buf->data[buf->size - 1] = th_strdup(str); |
401 } | 401 } |
402 } | 402 } |
403 | 403 |
404 | 404 |
405 int writeBuf(editbuf_t *buf, ssize_t pos, int ch) | 405 int writeBuf(editbuf_t *buf, ssize_t pos, int ch) |