Annotation of researchv9/jerq/src/lib/C/o_vec.c, revision 1.1.1.1

1.1       root        1: typedef void* PV;
                      2: typedef void (*PF)(PV);
                      3: 
                      4: extern PV _vec_new(PV op, int n, int sz, PV f)
                      5: /*
                      6:        allocate a vector of "n" elements of size "sz"
                      7:        and initialize each by a call of "f"
                      8: */
                      9: {
                     10:        register int i;
                     11:        register char* p;
                     12:        if (op == 0) op = PV( new char[n*sz] );
                     13:        p = (char*) op;
                     14:        for (i=0; i<n; i++) ( *PF(f) )( PV(p+i*sz) );
                     15:        return PV(p);
                     16: }
                     17: 
                     18: void _vec_delete(PV op, int n, int sz, PV f)
                     19: {
                     20:        register int i;
                     21:        register char* p = (char*) op;
                     22:        for (i=0; i<n; i++) ( *(PF)f )( (PV)(p+i*sz) );
                     23: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.