- Timestamp:
- Feb 28, 2009, 2:06:16 AM (16 years ago)
- Location:
- trunk/src/kash
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kash/Makefile.kmk
r2287 r2291 88 88 setmode.c \ 89 89 shinstance.c \ 90 shheap.c \ 90 91 shthread.c \ 91 92 shfile.c -
trunk/src/kash/shinstance.c
r2290 r2291 1 1 /* $Id$ */ 2 2 /** @file 3 *4 3 * The shell instance methods. 5 * 4 */ 5 6 /* 6 7 * Copyright (c) 2007-2009 knut st. osmundsen <bird-kBuild-spamix@anduin.net> 7 8 * … … 344 345 345 346 return ret; 346 }347 348 /** malloc() */349 void *sh_malloc(shinstance *psh, size_t size)350 {351 (void)psh;352 return malloc(size);353 }354 355 /** calloc() */356 void *sh_calloc(shinstance *psh, size_t num, size_t size)357 {358 (void)psh;359 return calloc(num, size);360 }361 362 /** realloc() */363 void *sh_realloc(shinstance *psh, void *old, size_t new_size)364 {365 return realloc(old, new_size);366 }367 368 /** strdup() */369 char *sh_strdup(shinstance *psh, const char *string)370 {371 size_t len = strlen(string);372 char *ret = sh_malloc(psh, len + 1);373 if (ret)374 memcpy(ret, string, len + 1);375 return ret;376 }377 378 /** free() */379 void sh_free(shinstance *psh, void *ptr)380 {381 if (ptr)382 free(ptr);383 (void)psh;384 347 } 385 348 -
trunk/src/kash/shinstance.h
r2290 r2291 1 1 /* $Id$ */ 2 2 /** @file 3 *4 3 * The shell instance and it's methods. 5 * 4 */ 5 6 /* 6 7 * Copyright (c) 2007-2009 knut st. osmundsen <bird-kBuild-spamix@anduin.net> 7 8 * … … 43 44 #include "shthread.h" 44 45 #include "shfile.h" 46 #include "shheap.h" 45 47 #include "shell.h" 46 48 #include "output.h" … … 335 337 char **sh_environ(shinstance *); 336 338 const char *sh_gethomedir(shinstance *, const char *); 337 338 /* heap */339 void *sh_malloc(shinstance *, size_t);340 void *sh_calloc(shinstance *, size_t, size_t);341 void *sh_realloc(shinstance *, void *, size_t);342 char *sh_strdup(shinstance *, const char *);343 void sh_free(shinstance *, void *);344 339 345 340 /* signals */
Note:
See TracChangeset
for help on using the changeset viewer.