1 /* str.c -- strings to be used in the CoAP library
3 * Copyright (C) 2010,2011 Olaf Bergmann <bergmann@tzi.org>
5 * This file is part of the CoAP library libcoap. Please see
6 * README for terms of use.
17 str *coap_new_string(size_t size) {
18 str *s = (str*)coap_malloc(sizeof(str) + size + 1);
21 coap_log(LOG_CRIT, "coap_new_string: malloc\n");
26 memset(s, 0, sizeof(str));
27 s->s = ((unsigned char *)s) + sizeof(str);
31 void coap_delete_string(str *s) {