PennMUSH Community

Changeset 953

Show
Ignore:
Timestamp:
06/17/07 23:01:43 (1 year ago)
Author:
shawnw
Message:

Get rid of some old _() prototypes in csrimalloc.c. That they were there shows how long it's been since anyone tried to compile it...

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • 1.8.2/branches/devel/hdrs/csrimalloc.h

    r932 r953  
    2222/* Tracing malloc definitions - helps find leaks */ 
    2323 
    24 extern univptr_t trace__malloc 
    25 _((size_t nbytes, const char *fname, int linenum)); 
    26 extern univptr_t trace__calloc 
    27 _((size_t nelem, size_t elsize, const char *fname, int linenum)); 
    28 extern univptr_t trace__realloc 
    29 _((univptr_t cp, size_t nbytes, const char *fname, int linenum)); 
    30 extern univptr_t trace__valloc _((size_t size, const char *fname, int linenum)); 
    31 extern univptr_t trace__memalign 
    32 _((size_t alignment, size_t size, const char *fname, int linenum)); 
    33 extern univptr_t trace__emalloc 
    34 _((size_t nbytes, const char *fname, int linenum)); 
    35 extern univptr_t trace__ecalloc 
    36 _((size_t nelem, size_t sz, const char *fname, int linenum)); 
    37 extern univptr_t trace__erealloc 
    38 _((univptr_t ptr, size_t nbytes, const char *fname, int linenum)); 
    39 extern char *trace__strdup _((const char *s, const char *fname, int linenum)); 
    40 extern char *trace__strsave _((const char *s, const char *fname, int linenum)); 
    41 extern void trace__free _((univptr_t cp, const char *fname, int linenum)); 
    42 extern void trace__cfree _((univptr_t cp, const char *fname, int linenum)); 
     24univptr_t trace__malloc(size_t nbytes, const char *fname, int linenum); 
     25univptr_t trace__calloc 
     26  (size_t nelem, size_t elsize, const char *fname, int linenum); 
     27univptr_t trace__realloc 
     28  (univptr_t cp, size_t nbytes, const char *fname, int linenum); 
     29univptr_t trace__valloc(size_t size, const char *fname, int linenum); 
     30univptr_t trace__memalign 
     31  (size_t alignment, size_t size, const char *fname, int linenum); 
     32univptr_t trace__emalloc(size_t nbytes, const char *fname, int linenum); 
     33univptr_t trace__ecalloc 
     34  (size_t nelem, size_t sz, const char *fname, int linenum); 
     35univptr_t trace__erealloc 
     36  (univptr_t ptr, size_t nbytes, const char *fname, int linenum); 
     37char *trace__strdup(const char *s, const char *fname, int linenum); 
     38char *trace__strsave(const char *s, const char *fname, int linenum); 
     39void trace__free(univptr_t cp, const char *fname, int linenum); 
     40void trace__cfree(univptr_t cp, const char *fname, int linenum); 
    4341 
    4442#define malloc(x)               trace__malloc((x), __FILE__, __LINE__) 
     
    5856#else                           /* CSRI_TRACE */ 
    5957 
    60 extern univptr_t malloc _((size_t nbytes)); 
    61 extern univptr_t calloc _((size_t nelem, size_t elsize)); 
    62 extern univptr_t realloc _((univptr_t cp, size_t nbytes)); 
    63 extern univptr_t valloc _((size_t size)); 
    64 extern univptr_t memalign _((size_t alignment, size_t size)); 
    65 extern univptr_t emalloc _((size_t nbytes)); 
    66 extern univptr_t ecalloc _((size_t nelem, size_t sz)); 
    67 extern univptr_t erealloc _((univptr_t ptr, size_t nbytes)); 
    68 extern char *strdup _((const char *s)); 
    69 extern char *strsave _((const char *s)); 
    70 extern Free_t free _((univptr_t cp)); 
    71 extern Free_t cfree _((univptr_t cp)); 
     58univptr_t malloc(size_t nbytes); 
     59univptr_t calloc(size_t nelem, size_t elsize); 
     60univptr_t realloc(univptr_t cp, size_t nbytes); 
     61univptr_t valloc(size_t size); 
     62univptr_t memalign(size_t alignment, size_t size); 
     63univptr_t emalloc(size_t nbytes); 
     64univptr_t ecalloc(size_t nelem, size_t sz); 
     65univptr_t erealloc(univptr_t ptr, size_t nbytes); 
     66char *strdup(const char *s); 
     67char *strsave(const char *s); 
     68void free(univptr_t cp); 
     69void cfree(univptr_t cp); 
    7270 
    7371#endif                          /* CSRI_TRACE */ 
    7472 
    75 extern void mal_debug _((int level)); 
    76 extern void mal_dumpleaktrace _((FILE * fp)); 
    77 extern void mal_heapdump _((FILE * fp)); 
    78 extern void mal_leaktrace _((int value)); 
    79 extern void mal_sbrkset _((int n)); 
    80 extern void mal_slopset _((int n)); 
    81 extern void mal_statsdump _((FILE * fp)); 
    82 extern void mal_setstatsfile _((FILE * fp)); 
    83 extern void mal_trace _((int value)); 
    84 extern int mal_verify _((int fullcheck)); 
    85 extern void mal_mmap _((char *fname)); 
     73void mal_debug(int level); 
     74void mal_dumpleaktrace(FILE * fp); 
     75void mal_heapdump(FILE * fp); 
     76void mal_leaktrace(int value); 
     77void mal_sbrkset(int n); 
     78void mal_slopset(int n); 
     79void mal_statsdump(FILE * fp); 
     80void mal_setstatsfile(FILE * fp); 
     81void mal_trace(int value); 
     82int mal_verify(int fullcheck); 
     83void mal_mmap(char *fname); 
    8684 
    8785 
  • 1.8.2/branches/devel/src/csrimalloc.c

    r932 r953  
    3838#undef cfree(p) 
    3939#undef free(p) 
    40 extern char *strdup _((const char *)); 
     40extern char *strdup(const char *); 
    4141#endif 
    4242 
     
    112112/* Character Handling: <string.h> */ 
    113113 
     114#if 0 
     115/* We'd better not have to do this - Javelin */ 
     116 
    114117#ifndef HAS_MEMSET 
    115118extern univptr_t memset proto((univptr_t, int, memsize_t)); 
     
    120123#endif 
    121124 
    122 #if 0 
    123 /* We'd better not have to do this - Javelin */ 
    124125extern char *strcpy proto((char *, const char *)); 
    125126extern memsize_t strlen proto((const char *)); 
     
    785786#endif                          /* CSRI_DEBUG */ 
    786787 
    787 univptr_t (*_malloc_memfunc) proto((size_t)) = _mal_sbrk; 
     788univptr_t(*_malloc_memfunc) proto((size_t)) = _mal_sbrk; 
    788789 
    789790#ifndef __GLOBALS_H__ 
     
    794795 */ 
    795796 
    796 extern 
    797 size_t _malloc_minchunk; 
    798  
    799 extern Word *_malloc_rovers[]; 
    800 extern const 
    801 size_t _malloc_binmax[]; 
    802 extern int 
    803  _malloc_firstbin; 
    804 extern int 
    805  _malloc_lastbin; 
    806 extern Word *_malloc_hiword; 
    807 extern Word *_malloc_loword; 
    808  
    809 extern 
    810 size_t _malloc_sbrkunits; 
    811  
    812 extern Word *_malloc_mem; 
    813  
    814 extern int 
    815  _malloc_tracing;               /* No tracing */ 
    816 extern char 
    817  _malloc_statsbuf[]; 
    818  
    819 extern int 
    820  _malloc_leaktrace; 
     797    extern 
     798      size_t 
     799      _malloc_minchunk; 
     800 
     801    extern Word * 
     802      _malloc_rovers[]; 
     803    extern const 
     804      size_t 
     805      _malloc_binmax[]; 
     806    extern int 
     807      _malloc_firstbin; 
     808    extern int 
     809      _malloc_lastbin; 
     810    extern Word * 
     811      _malloc_hiword; 
     812    extern Word * 
     813      _malloc_loword; 
     814 
     815    extern 
     816      size_t 
     817      _malloc_sbrkunits; 
     818 
     819    extern Word * 
     820      _malloc_mem; 
     821 
     822    extern int 
     823      _malloc_tracing;          /* No tracing */ 
     824    extern char 
     825      _malloc_statsbuf[]; 
     826 
     827    extern int 
     828      _malloc_leaktrace; 
    821829 
    822830#ifdef CSRI_PROFILESIZES 
    823 extern int 
    824  _malloc_scount[]; 
     831    extern int 
     832      _malloc_scount[]; 
    825833#endif                          /* CSRI_PROFILESIZES */ 
    826834 
     
    831839 *  malloc/free/realloc/memalign. (the rest call these) 
    832840 */ 
    833 extern int 
    834  _malloc_debugging; 
     841    extern int 
     842      _malloc_debugging; 
    835843#endif                          /* CSRI_DEBUG */ 
    836844 
    837 extern 
    838 univptr_t (*_malloc_memfunc) proto((size_t)); 
    839  
    840 extern int 
    841 __m_prblock proto((univptr_t, int, FILE *)); 
     845    extern 
     846    univptr_t(*_malloc_memfunc) 
     847proto((size_t)); 
     848 
     849    extern int 
     850      __m_prblock 
     851    proto((univptr_t, int, FILE *)); 
    842852 
    843853#endif  /* __GLOBALS_H__ */                        /* Do not add anything after this line */ 
     
    857867#define SPTREE_H 
    858868 
    859 typedef struct _spblk { 
    860   struct _spblk *leftlink; 
    861   struct _spblk *rightlink; 
    862   struct _spblk *uplink; 
    863  
    864   univptr_t 
    865    key;                         /* formerly time/timetyp */ 
    866   univptr_t 
    867    data;                        /* formerly aux/auxtype */ 
    868   univptr_t 
    869    datb; 
    870 } SPBLK; 
    871  
    872 typedef struct { 
    873   SPBLK *root;                  /* root node */ 
    874  
    875   /* Statistics, not strictly necessary, but handy for tuning  */ 
    876  
    877   int 
    878    lookups;                     /* number of splookup()s */ 
    879   int 
    880    lkpcmps;                     /* number of lookup comparisons */ 
    881  
    882   int 
    883    enqs;                        /* number of spenq()s */ 
    884   int 
    885    enqcmps;                     /* compares in spenq */ 
    886  
    887   int 
    888    splays; 
    889   int 
    890    splayloops; 
    891  
    892 } SPTREE; 
     869    typedef struct _spblk { 
     870      struct _spblk * 
     871        leftlink; 
     872      struct _spblk * 
     873        rightlink; 
     874      struct _spblk * 
     875        uplink; 
     876 
     877      univptr_t 
     878        key;                    /* formerly time/timetyp */ 
     879      univptr_t 
     880        data;                   /* formerly aux/auxtype */ 
     881      univptr_t 
     882        datb; 
     883    } SPBLK; 
     884 
     885    typedef struct { 
     886      SPBLK * 
     887        root;                   /* root node */ 
     888 
     889      /* Statistics, not strictly necessary, but handy for tuning  */ 
     890 
     891      int 
     892        lookups;                /* number of splookup()s */ 
     893      int 
     894        lkpcmps;                /* number of lookup comparisons */ 
     895 
     896      int 
     897        enqs;                   /* number of spenq()s */ 
     898      int 
     899        enqcmps;                /* compares in spenq */ 
     900 
     901      int 
     902        splays; 
     903      int 
     904        splayloops; 
     905 
     906    } SPTREE; 
    893907 
    894908#if defined(__STDC__) 
     
    900914/* sptree.c */ 
    901915/* init tree */ 
    902 extern SPTREE *__spinit __proto((void)); 
     916    extern SPTREE * 
     917      __spinit 
     918    __proto((void)); 
    903919/* find key in a tree */ 
    904 extern SPBLK *__splookup __proto((univptr_t, SPTREE *)); 
     920    extern SPBLK * 
     921      __splookup 
     922    __proto((univptr_t, SPTREE *)); 
    905923/* enter an item, allocating or replacing */ 
    906 extern SPBLK *__spadd __proto((univptr_t, univptr_t, univptr_t, SPTREE *)); 
     924    extern SPBLK * 
     925      __spadd 
     926    __proto((univptr_t, univptr_t, univptr_t, SPTREE *)); 
    907927/* scan forward through tree */ 
    908 extern void 
    909 __spscan __proto((void (*)__proto((SPBLK *)), SPBLK *, SPTREE *)); 
     928    extern void 
     929      __spscan 
     930    __proto((void (*)__proto((SPBLK *)), SPBLK *, SPTREE *)); 
    910931/* return tree statistics */ 
    911 extern char *__spstats __proto((SPTREE *)); 
     932    extern char * 
     933      __spstats 
     934    __proto((SPTREE *)); 
    912935/* delete node from tree */ 
    913 extern void 
    914 __spdelete __proto((SPBLK *, SPTREE *)); 
     936    extern void 
     937      __spdelete 
     938    __proto((SPBLK *, SPTREE *)); 
    915939 
    916940#undef __proto 
     
    920944#ifndef __CSRI_TRACE_H__ 
    921945#define __CSRI_TRACE_H__ 
    922 extern void 
    923 __m_install_record proto((univptr_t, const char *)); 
    924 extern void 
    925 __m_delete_record proto((univptr_t)); 
     946    extern void 
     947      __m_install_record 
     948    proto((univptr_t, const char *)); 
     949    extern void 
     950      __m_delete_record 
     951    proto((univptr_t)); 
    926952 
    927953#define RECORD_FILE_AND_LINE(addr, fname, linenum) \ 
     
    944970#ifdef CSRI_TRACE 
    945971/* Tracing malloc definitions - helps find leaks */ 
     972    univptr_t 
     973    trace__malloc(size_t nbytes, const char *fname, int linenum); 
     974    univptr_t 
     975    trace__calloc(size_t nelem, size_t elsize, const char *fname, int linenum); 
     976    univptr_t 
     977    trace__realloc(univptr_t cp, size_t nbytes, const char *fname, int linenum); 
     978    univptr_t 
     979    trace__valloc(size_t size, const char *fname, int linenum); 
     980    univptr_t 
     981    trace__memalign 
     982      (size_t alignment, size_t size, const char *fname, int linenum); 
     983    univptr_t 
     984    trace__emalloc(size_t nbytes, const char *fname, int linenum); 
    946985univptr_t 
    947 trace__malloc _((size_t nbytes, const char *fname, int linenum)); 
     986trace__ecalloc(size_t nelem, size_t sz, const char *fname, int linenum); 
    948987univptr_t 
    949 trace__calloc _((size_t nelem, size_t elsize, const char *fname, int linenum)); 
    950 univptr_t 
    951 trace__realloc _((univptr_t cp, size_t nbytes, const char *fname, int linenum)); 
    952 univptr_t trace__valloc _((size_t size, const char *fname, int linenum)); 
    953 univptr_t 
    954  trace__memalign 
    955 _((size_t alignment, size_t size, const char *fname, int linenum)); 
    956 univptr_t trace__emalloc _((size_t nbytes, const char *fname, int linenum)); 
    957 univptr_t 
    958 trace__ecalloc _((size_t nelem, size_t sz, const char *fname, int linenum)); 
    959 univptr_t 
    960  trace__erealloc 
    961 _((univptr_t ptr, size_t nbytes, const char *fname, int linenum)); 
    962 char *trace__strdup _((const char *s, const char *fname, int linenum)); 
    963 char *trace__strsave _((const char *s, const char *fname, int linenum)); 
    964 void 
    965 trace__free _((univptr_t cp, const char *fname, int linenum)); 
    966 void 
    967 trace__cfree _((univptr_t cp, const char *fname, int linenum)); 
     988  trace__erealloc(univptr_t ptr, size_t nbytes, const char *fname, int linenum); 
     989    char *trace__strdup(const char *s, const char *fname, int linenum); 
     990    char *trace__strsave(const char *s, const char *fname, int linenum); 
     991    void 
     992     trace__free(univptr_t cp, const char *fname, int linenum); 
     993    void 
     994     trace__cfree(univptr_t cp, const char *fname, int linenum); 
    968995#else                           /* CSRI_TRACE */ 
    969 univptr_t 
    970 malloc _((size_t nbytes)); 
    971 univptr_t 
    972 calloc _((size_t nelem, size_t elsize)); 
    973 univptr_t 
    974 realloc _((univptr_t cp, size_t nbytes)); 
    975 univptr_t 
    976 valloc _((size_t size)); 
    977 univptr_t 
    978 memalign _((size_t alignment, size_t size)); 
    979 univptr_t 
    980 emalloc _((size_t nbytes)); 
    981 univptr_t 
    982 ecalloc _((size_t nelem, size_t sz)); 
    983 univptr_t 
    984 erealloc _((univptr_t ptr, size_t nbytes)); 
    985 Free_t free _((univptr_t cp)); 
    986 Free_t cfree _((univptr_t cp)); 
     996    univptr_t 
     997    malloc(size_t nbytes); 
     998    univptr_t 
     999    calloc(size_t nelem, size_t elsize); 
     1000    univptr_t 
     1001    realloc(univptr_t cp, size_t nbytes); 
     1002    univptr_t 
     1003    valloc(size_t size); 
     1004    univptr_t 
     1005    memalign(size_t alignment, size_t size); 
     1006    univptr_t 
     1007    emalloc(size_t nbytes); 
     1008    univptr_t 
     1009    ecalloc(size_t nelem, size_t sz); 
     1010    univptr_t 
     1011    erealloc(univptr_t ptr, size_t nbytes); 
     1012    Free_t 
     1013    free(univptr_t cp); 
     1014    Free_t 
     1015    cfree(univptr_t cp); 
    9871016#endif                          /* CSRI_TRACE */ 
    9881017 
    989 int 
    990  __m_botch 
    991 _((const char *s1, const char *s2, univptr_t p, 
    992    int is_end_ptr, const char *filename, int linenumber)); 
    993 void 
    994 __m_prnode _((SPBLK * spblk)); 
    995 void 
    996 mal_contents _((FILE * fp)); 
     1018    int 
     1019    __m_botch 
     1020      (const char *s1, const char *s2, univptr_t p, 
     1021       int is_end_ptr, const char *filename, int linenumber); 
     1022    void 
     1023    __m_prnode(SPBLK * spblk); 
     1024    void 
     1025    mal_contents(FILE * fp); 
    9971026#ifdef CSRI_DEBUG 
    998 void 
    999 mal_debug _((int level)); 
    1000 int 
    1001 mal_verify _((int fullcheck)); 
    1002 #endif 
    1003 void 
    1004 mal_dumpleaktrace _((FILE * fp)); 
    1005 void 
    1006 mal_heapdump _((FILE * fp)); 
    1007 void 
    1008 mal_leaktrace _((int value)); 
    1009 void 
    1010 mal_sbrkset _((int n)); 
    1011 void 
    1012 mal_slopset _((int n)); 
     1027    void 
     1028    mal_debug(int level); 
     1029    int 
     1030    mal_verify(int fullcheck); 
     1031#endif 
     1032    void 
     1033    mal_dumpleaktrace(FILE * fp); 
     1034    void 
     1035    mal_heapdump(FILE * fp); 
     1036    void 
     1037    mal_leaktrace(int value); 
     1038    void 
     1039    mal_sbrkset(int n); 
     1040    void 
     1041    mal_slopset(int n); 
    10131042#ifdef CSRI_PROFILESIZES 
    1014 void 
    1015 mal_statsdump _((FILE * fp)); 
    1016 #endif 
    1017 void 
    1018 mal_trace _((int value)); 
    1019 void 
    1020 mal_mmap _((char *fname)); 
     1043    void 
     1044    mal_statsdump(FILE * fp); 
     1045#endif 
     1046    void 
     1047    mal_trace(int value); 
     1048    void 
     1049    mal_mmap(char *fname); 
    10211050 
    10221051#ifdef CSRI_TRACE 
     
    10401069univptr_t 
    10411070trace__erealloc(ptr, nbytes, fname, linenum) 
    1042     univptr_t 
    1043      ptr; 
     1071    univptr_t ptr; 
    10441072    size_t nbytes; 
    10451073    const char *fname; 
     
    11111139univptr_t 
    11121140trace__realloc(cp, nbytes, fname, linenum) 
    1113     univptr_t 
    1114      cp; 
     1141    univptr_t cp; 
    11151142    size_t nbytes; 
    11161143    const char *fname; 
     
    14701497univptr_t 
    14711498erealloc(ptr, nbytes) 
    1472     univptr_t 
    1473      ptr; 
     1499    univptr_t ptr; 
    14741500    size_t nbytes; 
    14751501{ 
     
    15651591    if ((char *) p + nbytes > mmf.i_end) { 
    15661592      errno = ENOMEM; 
    1567       return (univptr_t) -1; 
     1593      return (univptr_t) - 1; 
    15681594    } 
    15691595    mmf.i_alloced += nbytes; 
     
    15781604    if (mmap_filename == NULL) { 
    15791605      errno = ENOMEM; 
    1580       return (univptr_t) -1; 
     1606      return (univptr_t) - 1; 
    15811607    } 
    15821608  } 
    15831609  mmf.i_fd = open(mmap_filename, O_RDWR, 0666); 
    15841610  if (mmf.i_fd < 0 || fstat(mmf.i_fd, &stbuf) < 0) 
    1585     return (univptr_t) -1; 
     1611    return (univptr_t) - 1; 
    15861612  if (stbuf.st_size < nbytes) { 
    15871613    errno = ENOMEM; 
    1588     return (univptr_t) -1; 
     1614    return (univptr_t) - 1; 
    15891615  } 
    15901616  mmf.i_size = stbuf.st_size; 
     
    15921618                    MAP_SHARED, mmf.i_fd, (off_t) 0); 
    15931619  if (mmf.i_data == (caddr_t) - 1) 
    1594     return (univptr_t) -1; 
     1620    return (univptr_t) - 1; 
    15951621  mmf.i_end = mmf.i_data + mmf.i_size; 
    15961622  mmf.i_alloced = nbytes; 
     
    16041630    size_t nbytes __attribute__ ((__unused__)); 
    16051631{ 
    1606   return (univptr_t) -1; 
     1632  return (univptr_t) - 1; 
    16071633} 
    16081634 
     
    17371763} 
    17381764 
    1739 static void __m_count _((SPBLK * spblk)); 
     1765static void __m_count(SPBLK * spblk); 
    17401766 
    17411767static void 
     
    18591885         } 
    18601886 
    1861 static int grabhunk _((size_t)); 
     1887static int grabhunk(size_t); 
    18621888 
    18631889static int 
     
    18811907                        _malloc_sbrkunits); 
    18821908  morecore = sbrkwords * sizeof(Word) + SBRKEXTRA; 
    1883   if ((cp = (*_malloc_memfunc) (morecore)) == (univptr_t) -1) 
     1909  if ((cp = (*_malloc_memfunc) (morecore)) == (univptr_t) - 1) 
    18841910    return (0); 
    18851911  /*  
     
    20612087Free_t 
    20622088free(cp) 
    2063     univptr_t 
    2064      cp; 
     2089    univptr_t cp; 
    20652090{ 
    20662091  /*  
     
    21982223univptr_t 
    21992224realloc(cp, nbytes) 
    2200     univptr_t 
    2201      cp; 
     2225    univptr_t cp; 
    22022226    size_t nbytes; 
    22032227{ 
     
    23132337Free_t 
    23142338cfree(cp) 
    2315     univptr_t 
    2316      cp; 
     2339    univptr_t cp; 
    23172340{ 
    23182341#ifdef INT_FREE