Back to index

tetex-bin  3.0
Functions
doalloc.c File Reference
#include <curses.priv.h>

Go to the source code of this file.

Functions

 _nc_doalloc (void *oldp, size_t amount)
 _nc_strdup (const char *src)

Function Documentation

_nc_doalloc ( void oldp,
size_t  amount 
)

Definition at line 45 of file doalloc.c.

{
    void *newp;

    if (oldp != 0) {
       if ((newp = realloc(oldp, amount)) == 0) {
           free(oldp);
           errno = ENOMEM;  /* just in case 'free' reset */
       }
    } else {
       newp = malloc(amount);
    }
    return newp;
}

Here is the call graph for this function:

Here is the caller graph for this function:

_nc_strdup ( const char *  src)

Definition at line 62 of file doalloc.c.

{
    char *dst;
    if (src != 0) {
       dst = typeMalloc(char, strlen(src) + 1);
       if (dst != 0) {
           (void) strcpy(dst, src);
       }
    } else {
       dst = 0;
    }
    return dst;
}

Here is the call graph for this function: