Changeset 2291 for trunk/src


Ignore:
Timestamp:
Feb 28, 2009, 2:06:16 AM (16 years ago)
Author:
bird
Message:

hash: cooked our own heap on windows (for forking).

Location:
trunk/src/kash
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kash/Makefile.kmk

    r2287 r2291  
    8888        setmode.c \
    8989        shinstance.c \
     90        shheap.c \
    9091        shthread.c \
    9192        shfile.c
  • trunk/src/kash/shinstance.c

    r2290 r2291  
    11/* $Id$ */
    22/** @file
    3  *
    43 * The shell instance methods.
    5  *
     4 */
     5
     6/*
    67 * Copyright (c) 2007-2009  knut st. osmundsen <bird-kBuild-spamix@anduin.net>
    78 *
     
    344345
    345346    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;
    384347}
    385348
  • trunk/src/kash/shinstance.h

    r2290 r2291  
    11/* $Id$ */
    22/** @file
    3  *
    43 * The shell instance and it's methods.
    5  *
     4 */
     5
     6/*
    67 * Copyright (c) 2007-2009  knut st. osmundsen <bird-kBuild-spamix@anduin.net>
    78 *
     
    4344#include "shthread.h"
    4445#include "shfile.h"
     46#include "shheap.h"
    4547#include "shell.h"
    4648#include "output.h"
     
    335337char **sh_environ(shinstance *);
    336338const 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 *);
    344339
    345340/* signals */
Note: See TracChangeset for help on using the changeset viewer.