comparison libnnchat.c @ 325:c086345d176b

Move some functions to libnnchat and rename nn_find_window to findWindow()
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 11 Jun 2011 10:03:44 +0300
parents a0c001672b44
children 8e509d6546d3
comparison
equal deleted inserted replaced
324:ba4cc7ebe311 325:c086345d176b
889 if (*c == 255) *c = ' '; 889 if (*c == 255) *c = ' ';
890 return str; 890 return str;
891 } 891 }
892 892
893 893
894 nn_window_t *nn_window_new(const char *id)
895 {
896 nn_window_t *res = th_calloc(1, sizeof(nn_window_t));
897
898 if (res == NULL) return NULL;
899
900 res->data = th_ringbuf_new(NN_BACKBUF_LEN, th_free);
901 if (res->data == NULL) {
902 th_free(res);
903 return NULL;
904 }
905
906 res->id = th_strdup(id);
907
908 return res;
909 }
910
911
912 void nn_window_free(nn_window_t *win)
913 {
914 if (win != NULL) {
915 th_ringbuf_free(win->data);
916 th_free(win->id);
917 th_free(win);
918 }
919 }