Changeset 22804 for v6

Show
Ignore:
Timestamp:
10/28/08 16:54:30 (2 months ago)
Author:
ruoso
Message:

[smop-XS] makes the av_len weirdness less awkward... better to return av_len + 1 instead of doing +2 in the malloc...

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • v6/smop/SMOP/SMOP.xs

    r22802 r22804  
    109109  CODE: 
    110110    AV* constsav = (AV*)SvRV(consts); 
    111     int constslen = av_len(constsav); 
    112     SMOP__Object** consts_arr = calloc(constslen+2,sizeof(void*)); 
     111    int constslen = av_len(constsav) + 1; 
     112    SMOP__Object** consts_arr = calloc(constslen+1,sizeof(void*)); 
    113113    int i; 
    114114    for (i = 0; i <= constslen; i++) { 
     
    131131    } 
    132132    AV* codeav = (AV*)SvRV(bytecode); 
    133     int codelen = av_len(codeav); 
    134     int* code_arr = calloc(codelen+2,sizeof(void*)); 
     133    int codelen = av_len(codeav) + 1; 
     134    int* code_arr = calloc(codelen+1,sizeof(void*)); 
    135135    for (i = 0; i <= codelen; i++) { 
    136136        SV** e = av_fetch(codeav,i,0);