X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=lib%2Fsilcutil%2Fsilcmemory.h;h=632af872021736455b4ecea20aa5148af3046978;hb=e7b6c157b80152bf9fb9266e6bdd93f9fb0db776;hp=7dc60062ef1b440c5e4af4f14048b5fe46504546;hpb=51558729d89b9f3492b2ca754242ed548a579ca4;p=silc.git diff --git a/lib/silcutil/silcmemory.h b/lib/silcutil/silcmemory.h index 7dc60062..632af872 100644 --- a/lib/silcutil/silcmemory.h +++ b/lib/silcutil/silcmemory.h @@ -44,7 +44,7 @@ * * Allocates memory of `size' bytes and returns pointer to the allocated * memory area. Free the memory by calling silc_free. Returns NULL on - * error. + * error and sets silc_errno. * ***/ void *silc_malloc(size_t size); @@ -60,7 +60,7 @@ void *silc_malloc(size_t size); * Allocates memory of for an array of `items' elements of `size' bytes * and returns pointer to the allocated memory area. The memory area is * also zeroed. Free the memory by calling silc_free. Returns NULL on - * error. + * error and sets silc_errno. * ***/ void *silc_calloc(size_t items, size_t size); @@ -127,7 +127,7 @@ void *silc_memdup(const void *ptr, size_t size); * DESCRIPTION * * Duplicates the string indicated by `str' and returns the duplicated - * string. Returns NULL on error. + * string. Returns NULL on error and sets silc_errno. * ***/ char *silc_strdup(const char *str); @@ -203,17 +203,13 @@ void *silc_scalloc(SilcStack stack, SilcUInt32 items, SilcUInt32 size); * size of `size' bytes. The contents of `ptr' will not be changed. * If `ptr' is NULL the call is equivalent to silc_smalloc. If `size' * is zero (0) error will occur. Returns NULL on error and the old - * pointer remain intact. + * pointer remain intact. This may return different pointer from `ptr' * * NOTES * - * This function reallocates successfully only if the previous allocation - * to `stack' was `ptr'. If there was another memory allocation between - * allocating `ptr' and this call, this routine will return NULL. The - * NULL is also returned if the `size' does not fit to current stack - * and allocating new block would require slow copying of the data. It - * is left to the caller to decide whether to allocate new pointer and - * copy the old data in case this function returns NULL. + * If the reallocation from `stack' fails, this function will allocate + * new block of size of `size' bytes from `stack' and copy the data from + * `ptr' to the new memory block. * * If `stack' is NULL this function calls silc_realloc. *