Changeset 02d241f


Ignore:
Timestamp:
Apr 16, 2017, 9:16:18 PM (5 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
33e22da
Parents:
19b2133
Message:

changes to malloc and bsearch

Location:
src/libcfa
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/Makefile.in

    r19b2133 r02d241f  
    9999am__libcfa_d_a_SOURCES_DIST = libcfa-prelude.c interpose.c \
    100100        libhdr/libdebug.c limits.c stdlib.c math.c iostream.c \
    101         fstream.c iterator.c rational.c assert.c containers/vector.c \
    102         concurrency/coroutine.c concurrency/thread.c \
    103         concurrency/kernel.c concurrency/monitor.c \
    104         concurrency/CtxSwitch-@MACHINE_TYPE@.S concurrency/invoke.c
     101        fstream.c iterator.c rational.c assert.c containers/pair.c \
     102        containers/vector.c concurrency/coroutine.c \
     103        concurrency/thread.c concurrency/kernel.c \
     104        concurrency/monitor.c concurrency/CtxSwitch-@MACHINE_TYPE@.S \
     105        concurrency/invoke.c
    105106am__dirstamp = $(am__leading_dot)dirstamp
    106107@BUILD_CONCURRENCY_TRUE@am__objects_1 = concurrency/libcfa_d_a-coroutine.$(OBJEXT) \
     
    113114        libcfa_d_a-iterator.$(OBJEXT) libcfa_d_a-rational.$(OBJEXT) \
    114115        libcfa_d_a-assert.$(OBJEXT) \
     116        containers/libcfa_d_a-pair.$(OBJEXT) \
    115117        containers/libcfa_d_a-vector.$(OBJEXT) $(am__objects_1)
    116118@BUILD_CONCURRENCY_TRUE@am__objects_3 = concurrency/CtxSwitch-@MACHINE_TYPE@.$(OBJEXT) \
     
    126128am__libcfa_a_SOURCES_DIST = libcfa-prelude.c interpose.c \
    127129        libhdr/libdebug.c limits.c stdlib.c math.c iostream.c \
    128         fstream.c iterator.c rational.c assert.c containers/vector.c \
    129         concurrency/coroutine.c concurrency/thread.c \
    130         concurrency/kernel.c concurrency/monitor.c \
    131         concurrency/CtxSwitch-@MACHINE_TYPE@.S concurrency/invoke.c
     130        fstream.c iterator.c rational.c assert.c containers/pair.c \
     131        containers/vector.c concurrency/coroutine.c \
     132        concurrency/thread.c concurrency/kernel.c \
     133        concurrency/monitor.c concurrency/CtxSwitch-@MACHINE_TYPE@.S \
     134        concurrency/invoke.c
    132135@BUILD_CONCURRENCY_TRUE@am__objects_5 = concurrency/libcfa_a-coroutine.$(OBJEXT) \
    133136@BUILD_CONCURRENCY_TRUE@        concurrency/libcfa_a-thread.$(OBJEXT) \
     
    138141        libcfa_a-fstream.$(OBJEXT) libcfa_a-iterator.$(OBJEXT) \
    139142        libcfa_a-rational.$(OBJEXT) libcfa_a-assert.$(OBJEXT) \
     143        containers/libcfa_a-pair.$(OBJEXT) \
    140144        containers/libcfa_a-vector.$(OBJEXT) $(am__objects_5)
    141145@BUILD_CONCURRENCY_TRUE@am__objects_7 = concurrency/CtxSwitch-@MACHINE_TYPE@.$(OBJEXT) \
     
    176180        $(am__libcfa_a_SOURCES_DIST)
    177181am__nobase_cfa_include_HEADERS_DIST = limits stdlib math iostream \
    178         fstream iterator rational assert containers/vector \
    179         concurrency/coroutine concurrency/thread concurrency/kernel \
    180         concurrency/monitor ${shell echo stdhdr/*} \
     182        fstream iterator rational assert containers/pair \
     183        containers/vector concurrency/coroutine concurrency/thread \
     184        concurrency/kernel concurrency/monitor ${shell echo stdhdr/*} \
    181185        concurrency/invoke.h
    182186HEADERS = $(nobase_cfa_include_HEADERS)
     
    310314AM_CCASFLAGS = @CFA_FLAGS@
    311315headers = limits stdlib math iostream fstream iterator rational assert \
    312         containers/vector $(am__append_3)
     316        containers/pair containers/vector $(am__append_3)
    313317libobjs = ${headers:=.o}
    314318libsrc = libcfa-prelude.c interpose.c libhdr/libdebug.c ${headers:=.c} \
     
    400404        @$(MKDIR_P) containers/$(DEPDIR)
    401405        @: > containers/$(DEPDIR)/$(am__dirstamp)
     406containers/libcfa_d_a-pair.$(OBJEXT): containers/$(am__dirstamp) \
     407        containers/$(DEPDIR)/$(am__dirstamp)
    402408containers/libcfa_d_a-vector.$(OBJEXT): containers/$(am__dirstamp) \
    403409        containers/$(DEPDIR)/$(am__dirstamp)
     
    428434libhdr/libcfa_a-libdebug.$(OBJEXT): libhdr/$(am__dirstamp) \
    429435        libhdr/$(DEPDIR)/$(am__dirstamp)
     436containers/libcfa_a-pair.$(OBJEXT): containers/$(am__dirstamp) \
     437        containers/$(DEPDIR)/$(am__dirstamp)
    430438containers/libcfa_a-vector.$(OBJEXT): containers/$(am__dirstamp) \
    431439        containers/$(DEPDIR)/$(am__dirstamp)
     
    458466        -rm -f concurrency/libcfa_d_a-monitor.$(OBJEXT)
    459467        -rm -f concurrency/libcfa_d_a-thread.$(OBJEXT)
     468        -rm -f containers/libcfa_a-pair.$(OBJEXT)
    460469        -rm -f containers/libcfa_a-vector.$(OBJEXT)
     470        -rm -f containers/libcfa_d_a-pair.$(OBJEXT)
    461471        -rm -f containers/libcfa_d_a-vector.$(OBJEXT)
    462472        -rm -f libhdr/libcfa_a-libdebug.$(OBJEXT)
     
    497507@AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_d_a-monitor.Po@am__quote@
    498508@AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_d_a-thread.Po@am__quote@
     509@AMDEP_TRUE@@am__include@ @am__quote@containers/$(DEPDIR)/libcfa_a-pair.Po@am__quote@
    499510@AMDEP_TRUE@@am__include@ @am__quote@containers/$(DEPDIR)/libcfa_a-vector.Po@am__quote@
     511@AMDEP_TRUE@@am__include@ @am__quote@containers/$(DEPDIR)/libcfa_d_a-pair.Po@am__quote@
    500512@AMDEP_TRUE@@am__include@ @am__quote@containers/$(DEPDIR)/libcfa_d_a-vector.Po@am__quote@
    501513@AMDEP_TRUE@@am__include@ @am__quote@libhdr/$(DEPDIR)/libcfa_a-libdebug.Po@am__quote@
     
    681693@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-assert.obj `if test -f 'assert.c'; then $(CYGPATH_W) 'assert.c'; else $(CYGPATH_W) '$(srcdir)/assert.c'; fi`
    682694
     695containers/libcfa_d_a-pair.o: containers/pair.c
     696@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT containers/libcfa_d_a-pair.o -MD -MP -MF containers/$(DEPDIR)/libcfa_d_a-pair.Tpo -c -o containers/libcfa_d_a-pair.o `test -f 'containers/pair.c' || echo '$(srcdir)/'`containers/pair.c
     697@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) containers/$(DEPDIR)/libcfa_d_a-pair.Tpo containers/$(DEPDIR)/libcfa_d_a-pair.Po
     698@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='containers/pair.c' object='containers/libcfa_d_a-pair.o' libtool=no @AMDEPBACKSLASH@
     699@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     700@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o containers/libcfa_d_a-pair.o `test -f 'containers/pair.c' || echo '$(srcdir)/'`containers/pair.c
     701
     702containers/libcfa_d_a-pair.obj: containers/pair.c
     703@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT containers/libcfa_d_a-pair.obj -MD -MP -MF containers/$(DEPDIR)/libcfa_d_a-pair.Tpo -c -o containers/libcfa_d_a-pair.obj `if test -f 'containers/pair.c'; then $(CYGPATH_W) 'containers/pair.c'; else $(CYGPATH_W) '$(srcdir)/containers/pair.c'; fi`
     704@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) containers/$(DEPDIR)/libcfa_d_a-pair.Tpo containers/$(DEPDIR)/libcfa_d_a-pair.Po
     705@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='containers/pair.c' object='containers/libcfa_d_a-pair.obj' libtool=no @AMDEPBACKSLASH@
     706@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     707@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o containers/libcfa_d_a-pair.obj `if test -f 'containers/pair.c'; then $(CYGPATH_W) 'containers/pair.c'; else $(CYGPATH_W) '$(srcdir)/containers/pair.c'; fi`
     708
    683709containers/libcfa_d_a-vector.o: containers/vector.c
    684710@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT containers/libcfa_d_a-vector.o -MD -MP -MF containers/$(DEPDIR)/libcfa_d_a-vector.Tpo -c -o containers/libcfa_d_a-vector.o `test -f 'containers/vector.c' || echo '$(srcdir)/'`containers/vector.c
     
    904930@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    905931@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-assert.obj `if test -f 'assert.c'; then $(CYGPATH_W) 'assert.c'; else $(CYGPATH_W) '$(srcdir)/assert.c'; fi`
     932
     933containers/libcfa_a-pair.o: containers/pair.c
     934@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT containers/libcfa_a-pair.o -MD -MP -MF containers/$(DEPDIR)/libcfa_a-pair.Tpo -c -o containers/libcfa_a-pair.o `test -f 'containers/pair.c' || echo '$(srcdir)/'`containers/pair.c
     935@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) containers/$(DEPDIR)/libcfa_a-pair.Tpo containers/$(DEPDIR)/libcfa_a-pair.Po
     936@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='containers/pair.c' object='containers/libcfa_a-pair.o' libtool=no @AMDEPBACKSLASH@
     937@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     938@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o containers/libcfa_a-pair.o `test -f 'containers/pair.c' || echo '$(srcdir)/'`containers/pair.c
     939
     940containers/libcfa_a-pair.obj: containers/pair.c
     941@am__fastdepCC_TRUE@    $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT containers/libcfa_a-pair.obj -MD -MP -MF containers/$(DEPDIR)/libcfa_a-pair.Tpo -c -o containers/libcfa_a-pair.obj `if test -f 'containers/pair.c'; then $(CYGPATH_W) 'containers/pair.c'; else $(CYGPATH_W) '$(srcdir)/containers/pair.c'; fi`
     942@am__fastdepCC_TRUE@    $(AM_V_at)$(am__mv) containers/$(DEPDIR)/libcfa_a-pair.Tpo containers/$(DEPDIR)/libcfa_a-pair.Po
     943@AMDEP_TRUE@@am__fastdepCC_FALSE@       $(AM_V_CC)source='containers/pair.c' object='containers/libcfa_a-pair.obj' libtool=no @AMDEPBACKSLASH@
     944@AMDEP_TRUE@@am__fastdepCC_FALSE@       DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     945@am__fastdepCC_FALSE@   $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o containers/libcfa_a-pair.obj `if test -f 'containers/pair.c'; then $(CYGPATH_W) 'containers/pair.c'; else $(CYGPATH_W) '$(srcdir)/containers/pair.c'; fi`
    906946
    907947containers/libcfa_a-vector.o: containers/vector.c
  • src/libcfa/stdlib.c

    r19b2133 r02d241f  
    1010// Created On       : Thu Jan 28 17:10:29 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Apr  1 18:31:26 2017
    13 // Update Count     : 181
     12// Last Modified On : Sun Apr 16 10:41:05 2017
     13// Update Count     : 189
    1414//
    1515
     
    7878} // posix_memalign
    7979
    80 forall( dtype T, ttype Params | sized(T) | { void ?{}(T *, Params); } )
     80forall( dtype T, ttype Params | sized(T) | { void ?{}( T *, Params ); } )
    8181T * new( Params p ) {
    82         return ((T*)malloc()){ p };
     82        return ((T *)malloc()){ p };
    8383}
    8484
     
    229229forall( otype T | { int ?<?( T, T ); } )
    230230unsigned int bsearch( T key, const T * arr, size_t dimension ) {
    231         int comp( const void * t1, const void * t2 ) { return *(T *)t1 < *(T *)t2 ? -1 : *(T *)t2 < *(T *)t1 ? 1 : 0; }
    232         T *result = (T *)bsearch( &key, arr, dimension, sizeof(T), comp );
     231        T *result = bsearch( key, arr, dimension );
    233232        return result ? result - arr : dimension;                       // pointer subtraction includes sizeof(T)
    234233} // bsearch
Note: See TracChangeset for help on using the changeset viewer.