Changeset 14206


Ignore:
Timestamp:
Aug 24, 2010, 1:17:56 AM (9 years ago)
Author:
rme
Message:

Rename lisp kernel functions allocate() and deallocate() to
lisp_malloc() and lisp_free() to make it clearer that they are
kernel imports.

Use regular C library functions (malloc/calloc/free) instead of
allocate/deallocate in other lisp kernel C files.

Location:
trunk/source/lisp-kernel
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/lisp-kernel/imports.s

    r13970 r14206  
    4747        defimport(xGetSharedLibrary)
    4848        defimport(xFindSymbol)
    49         defimport(allocate)
    50         defimport(deallocate)
     49        defimport(lisp_malloc)
     50        defimport(lisp_free)
    5151        defimport(wait_for_signal)
    5252        defimport(tcr_frame_ptr)
  • trunk/source/lisp-kernel/lisp-exceptions.h

    r14119 r14206  
    108108Fatal(StringPtr, StringPtr);
    109109
    110 
    111 Ptr
    112 allocate(natural);
    113 
    114 Ptr
    115 zalloc(natural);
    116 
    117 void
    118 deallocate(Ptr);
    119 
    120 
    121 
    122110void
    123111non_fatal_error( char * );
  • trunk/source/lisp-kernel/memory.c

    r14197 r14206  
    5757}
    5858
    59 
    60 Ptr
    61 allocate(natural size)
    62 {
    63   return (Ptr) malloc(size);
    64 }
    65 
    66 void
    67 deallocate(Ptr p)
    68 {
    69   free((void *)p);
    70 }
    71 
    72 Ptr
    73 zalloc(natural size)
    74 {
    75   Ptr p = allocate(size);
    76   if (p != NULL) {
    77     memset(p, 0, size);
    78   }
    79   return p;
     59void *
     60lisp_malloc(size_t size)
     61{
     62  return malloc(size);
     63}
     64
     65void
     66lisp_free(void *p)
     67{
     68  free(p);
    8069}
    8170
     
    449438new_protected_area(BytePtr start, BytePtr end, lisp_protection_kind reason, natural protsize, Boolean now)
    450439{
    451   protected_area_ptr p = (protected_area_ptr) allocate(sizeof(protected_area));
     440  protected_area_ptr p = malloc(sizeof(protected_area));
    452441 
    453442  if (p == NULL) return NULL;
     
    568557new_area(BytePtr lowaddr, BytePtr highaddr, area_code code)
    569558{
    570   area *a = (area *) (zalloc(sizeof(area)));
     559  area *a = calloc(1, sizeof(area));
    571560  if (a) {
    572561    natural ndnodes = area_dnode(highaddr, lowaddr);
     
    865854  }
    866855
    867   deallocate((Ptr)p);
     856  free(p);
    868857}
    869858
     
    896885
    897886  if (h) free_stack(h);
    898   deallocate((Ptr)a);
     887  free(a);
    899888}
    900889
  • trunk/source/lisp-kernel/pmcl-kernel.c

    r14205 r14206  
    238238      if (base_p) *base_p = NULL;
    239239      if (h_p) *h_p = NULL;
    240       deallocate(h);
     240      free(h);
    241241      return NULL;
    242242    }
     
    854854
    855855  if (fatal_spare_ptr) {
    856     deallocate(fatal_spare_ptr);
     856    free(fatal_spare_ptr);
    857857    fatal_spare_ptr = NULL;
    858858  }
Note: See TracChangeset for help on using the changeset viewer.