fix windowisms: BOOL
[rofl0r-openbor.git] / source / stringptr.c
blobe3e32d86d70159113f73621c4d4bfba195bcc6ad
1 /*
2 * OpenBOR - http://www.LavaLit.com
3 * -----------------------------------------------------------------------
4 * Licensed under the BSD license, see LICENSE in OpenBOR root for details.
6 * Copyright (c) 2004 - 2011 OpenBOR Team
7 */
9 #include "stringptr.h"
10 #include <assert.h>
11 #include <string.h>
13 stringptr *new_string(size_t size) {
14 stringptr *result = malloc(sizeof(stringptr) + size + 1);
15 if(result == NULL)
16 return NULL;
17 result->ptr = (char *) result + sizeof(stringptr);
18 result->size = size;
19 *((char *) (result->ptr + size)) = '\0';
20 return result;
23 void free_string(stringptr * string) {
24 free(string);