/* ----------------------------------------------------------------------------- * misc.c * * Miscellaneous functions that don't really fit anywhere else. * * Author(s) : David Beazley (beazley@cs.uchicago.edu) * * Copyright (C) 1999-2000. The University of Chicago * See the file LICENSE for information on usage and redistribution. * ----------------------------------------------------------------------------- */ static char cvsroot[] = "$Header$"; #include "swig.h" /* ----------------------------------------------------------------------------- * Swig_copy_string() * * Duplicate a NULL-terminate string given as a char *. * ----------------------------------------------------------------------------- */ char * Swig_copy_string(const char *s) { char *c = 0; if (s) { c = (char *) malloc(strlen(s)+1); strcpy(c,s); } return c; }