Mercurial > hg > nnchat
comparison util.c @ 513:ef5a2aa8382b
Refactor input handling.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 05 Jun 2012 22:16:42 +0300 |
parents | 291e3caa91a0 |
children | 8a52651bb88d |
comparison
equal
deleted
inserted
replaced
512:93c8ba1ef55f | 513:ef5a2aa8382b |
---|---|
424 char * nn_editbuf_get_string(nn_editbuf_t *buf, size_t start, size_t end) | 424 char * nn_editbuf_get_string(nn_editbuf_t *buf, size_t start, size_t end) |
425 { | 425 { |
426 char *str; | 426 char *str; |
427 size_t siz; | 427 size_t siz; |
428 | 428 |
429 if (buf == NULL) | 429 if (buf == NULL || end > buf->len || start >= buf->len) |
430 return NULL; | |
431 | |
432 if (end > buf->len || start >= buf->len) | |
433 return NULL; | 430 return NULL; |
434 | 431 |
435 if (start <= end) | 432 if (start <= end) |
436 siz = end - start + 1; | 433 siz = end - start + 1; |
437 else | 434 else |