Add memory allocation cleanup to loadable objects.

Add gmk_alloc() and gmk_free() functions so loadable objects can access our
memory model.  Also provide a more extensive example in the manual.
This commit is contained in:
Paul Smith
2013-05-04 17:38:53 -04:00
parent a0c5d0c63f
commit 3484c9675a
7 changed files with 159 additions and 20 deletions

View File

@@ -36,13 +36,17 @@ test_expand (const char *val)
static char *
func_test (const char *funcname, int argc, char **argv)
{
char *mem;
if (strcmp (funcname, "test-expand") == 0)
return test_expand (argv[0]);
if (strcmp (funcname, "test-eval") == 0)
return test_eval (argv[0]);
return strdup ("unknown");
mem = gmk_alloc (strlen ("unknown") + 1);
strcpy (mem, "unknown");
return mem;
}
int