diff --git a/src/stdio/src/FibreIO/ScanStringArr.c b/src/stdio/src/FibreIO/ScanStringArr.c index 1cea0ff2..e8d25aeb 100644 --- a/src/stdio/src/FibreIO/ScanStringArr.c +++ b/src/stdio/src/FibreIO/ScanStringArr.c @@ -21,10 +21,7 @@ void FibreScanStringArray( SAC_ND_PARAM_out( resout_nt, array *), FILE *stream) array *SAC_ND_A_FIELD( res_nt ); int size; int i; - - SAC_ND_ALLOC__DESC( res_nt, 0); - SAC_ND_SET__RC( res_nt, 1); - + char* s; start_token = PARSE_STRING_ARRAY; doScan( stream); @@ -35,14 +32,18 @@ void FibreScanStringArray( SAC_ND_PARAM_out( resout_nt, array *), FILE *stream) } res = SAC_StringArray_alloc( dims, size); - + for( i=0; i < dims; i++) { res->shp[i] = shape[i]; } res->data = stringarray; + SAC_ND_ALLOC__DESC( res_nt, 0); + SAC_ND_SET__RC( res_nt, 1); + for( i=0; i < size ; i++) { + s = stringarray[i]; SAC_ND_DECL__DESC( s_nt, ); SAC_ND_ALLOC__DESC( s_nt, 0); SAC_ND_SET__RC( s_nt, 1); @@ -68,10 +69,7 @@ void FibreScanStringArrayStr( SAC_ND_PARAM_out( resout_nt, array *), char *strea array *SAC_ND_A_FIELD( res_nt ); int size; int i; - - SAC_ND_ALLOC__DESC( res_nt, 0); - SAC_ND_SET__RC( res_nt, 1); - + char* s; start_token = PARSE_STRING_ARRAY; yy_scan_string( stream); @@ -90,7 +88,11 @@ void FibreScanStringArrayStr( SAC_ND_PARAM_out( resout_nt, array *), char *strea res->data = stringarray; + SAC_ND_ALLOC__DESC( res_nt, 0); + SAC_ND_SET__RC( res_nt, 1); + for( i=0; i < size ; i++) { + s = stringarray[i]; SAC_ND_DECL__DESC( s_nt, ); SAC_ND_ALLOC__DESC( s_nt, 0); SAC_ND_SET__RC( s_nt, 1); diff --git a/src/stdio/src/File/mkstemp.c b/src/stdio/src/File/mkstemp.c index a903a657..8fd9a5a9 100644 --- a/src/stdio/src/File/mkstemp.c +++ b/src/stdio/src/File/mkstemp.c @@ -26,8 +26,7 @@ int SACmkstemp ( SAC_ND_PARAM_out_nodesc (filep_nt, FILE*), // initialise filep SAC_ND_A_FIELD (filep_nt) = NULL; - // alloc string descriptor and string - SAC_ND_ALLOC__DESC (str_nt, 0) + // alloc string SAC_ND_SET__RC (str_nt, 1) SAC_ND_A_FIELD (str_nt) = SAC_MALLOC (length + 1); @@ -46,6 +45,9 @@ int SACmkstemp ( SAC_ND_PARAM_out_nodesc (filep_nt, FILE*), error = errno; } } + // alloc string descriptor + SAC_ND_ALLOC__DESC (str_nt, 0) + SAC_ND_RET_out__NODESC (filep_nt, filep_nt) SAC_ND_RET_out (str_nt, str_nt) diff --git a/src/structures/src/StringArray/genarray.c b/src/structures/src/StringArray/genarray.c index 877d59f8..aa846b40 100644 --- a/src/structures/src/StringArray/genarray.c +++ b/src/structures/src/StringArray/genarray.c @@ -17,9 +17,6 @@ void SAC_StringArray_genarray( SAC_ND_PARAM_out( resout_nt, array *), int dim, size; int i; - SAC_ND_ALLOC__DESC( res_nt, 0); - SAC_ND_SET__RC( res_nt, 1); - dim = SAC_ND_A_DESC_SIZE( shp_nt ); size = 1; for( i=0; i < dim; i++) { @@ -28,6 +25,9 @@ void SAC_StringArray_genarray( SAC_ND_PARAM_out( resout_nt, array *), res = SAC_StringArray_alloc( dim, size); + SAC_ND_ALLOC__DESC( res_nt, 0); + SAC_ND_SET__RC( res_nt, 1); + for( i=0; i < dim; i++) { res->shp[i] = SAC_ND_READ( shp_nt, i); }