@@ -120,10 +120,10 @@ HL_PRIM vbyte *hl_file_contents( vbyte *name, int *size ) {
return NULL;
fseek(f,0,SEEK_END);
len = ftell(f);
- *size = len;
+ if( size ) *size = len;
fseek(f,0,SEEK_SET);
- content = (vbyte*)hl_gc_alloc_noptr(len+1);
- content[len] = 0; // final 0 for UTF8
+ content = (vbyte*)hl_gc_alloc_noptr(size ? len : len+1);
+ if( !size ) content[len] = 0; // final 0 for UTF8
while( len > 0 ) {
int d = (int)fread((char*)content + p,1,len,f);
if( d <= 0 ) {
@@ -98,7 +98,7 @@ HL_PRIM int hl_regexp_matched_pos( ereg *e, int m, int *len ) {
if( m < 0 || m >= e->nmatches )
hl_error_msg(USTR("Matched index %d outside bounds"),m);
start = e->matches[m*2];
- *len = e->matches[m*2+1] - start;
+ if( len ) *len = e->matches[m*2+1] - start;
return start;
}
@@ -206,7 +206,7 @@ HL_PRIM vbyte *hl_utf16_to_utf8( vbyte *str, int pos, int *size ) {
c++;
- *size = utf8bytes;
+ if( size ) *size = utf8bytes;
return out;