diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-09-14 19:47:20 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-09-14 19:47:20 +0000 |
commit | 875ae8e38bc3663e5057ca910e7ebe4b2994edb9 (patch) | |
tree | ddd3b3bc4d6f0343bae986aebbf9555c20f8e558 /python/sip/sipgen/heap.c | |
parent | cb61a0436524f8ceba31db51ce3f1c5d4afbbb0e (diff) | |
download | tdebindings-875ae8e38bc3663e5057ca910e7ebe4b2994edb9.tar.gz tdebindings-875ae8e38bc3663e5057ca910e7ebe4b2994edb9.zip |
Updated python directory
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebindings@1175349 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'python/sip/sipgen/heap.c')
-rw-r--r-- | python/sip/sipgen/heap.c | 115 |
1 files changed, 0 insertions, 115 deletions
diff --git a/python/sip/sipgen/heap.c b/python/sip/sipgen/heap.c deleted file mode 100644 index d6e94ccc..00000000 --- a/python/sip/sipgen/heap.c +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Wrappers around standard functions that use the heap. - * - * Copyright (c) 2007 - * Riverbank Computing Limited <info@riverbankcomputing.co.uk> - * - * This file is part of SIP. - * - * This copy of SIP is licensed for use under the terms of the SIP License - * Agreement. See the file LICENSE for more details. - * - * SIP is supplied WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - */ - - -#include <stdlib.h> -#include <stdarg.h> -#include <string.h> -#include <sys/types.h> - -#include "sip.h" - - -static void nomem(void); - - -/* - * Wrap malloc() and handle any errors. - */ - -void *sipMalloc(size_t n) -{ - void *h; - - if ((h = malloc(n)) == NULL) - nomem(); - - return h; -} - - -/* - * Wrap strdup() and handle any errors. - */ - -char *sipStrdup(char *s) -{ - char *h; - - if ((h = strdup(s)) == NULL) - nomem(); - - return h; -} - - -/* - * Return a string on the heap which is the concatonation of all the arguments. - */ - -char *concat(const char *s, ...) -{ - const char *sp; - char *new; - size_t len; - va_list ap; - - /* Find the length of the final string. */ - - len = 1; - va_start(ap,s); - - for (sp = s; sp != NULL; sp = va_arg(ap, const char *)) - len += strlen(sp); - - va_end(ap); - - /* Create the new string. */ - - new = sipMalloc(len); - *new = '\0'; - - va_start(ap,s); - - for (sp = s; sp != NULL; sp = va_arg(ap, const char *)) - strcat(new,sp); - - va_end(ap); - - return new; -} - - -/* - * Append a string to another that is on the heap. - */ - -void append(char **s,char *new) -{ - if ((*s = realloc(*s,strlen(*s) + strlen(new) + 1)) == NULL) - nomem(); - - strcat(*s,new); -} - - -/* - * Display a standard error message when the heap is exhausted. - */ - -static void nomem(void) -{ - fatal("Unable to allocate memory on the heap\n"); -} |