diff options
author | Paul Smith <psmith@gnu.org> | 2013-05-04 17:38:53 -0400 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2013-05-04 17:38:53 -0400 |
commit | 3e67695034a1e235cbcf2c70d283fe0cd6c77427 (patch) | |
tree | ac9c0c1179e567213ed25f3161b64fc0254e24c7 /tests/scripts | |
parent | 54eddcc711207137cbace67d1f922a7690bb90e8 (diff) | |
download | make-3e67695034a1e235cbcf2c70d283fe0cd6c77427.tar.gz |
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.
Diffstat (limited to 'tests/scripts')
-rw-r--r-- | tests/scripts/features/loadapi | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/scripts/features/loadapi b/tests/scripts/features/loadapi index cecb114f..94a48a71 100644 --- a/tests/scripts/features/loadapi +++ b/tests/scripts/features/loadapi @@ -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 |