X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Fspv%2Fspv-legacy-data.c;h=59c9331e9f07161041f147ed4119a60db6c7c089;hb=47af71b93ed4673d23594ed2b84743f15638f7b7;hp=da9293ce4826055d02113801f95c710e7ff03ae8;hpb=50f6ea7d66d03895020891215fb4f55bbf061003;p=pspp diff --git a/src/output/spv/spv-legacy-data.c b/src/output/spv/spv-legacy-data.c index da9293ce48..59c9331e9f 100644 --- a/src/output/spv/spv-legacy-data.c +++ b/src/output/spv/spv-legacy-data.c @@ -281,7 +281,7 @@ decode_variable_map (const char *source_name, #endif } #endif - + value->width = strlen (label->label); value->s = xmemdup0 (label->label, value->width); } @@ -334,7 +334,7 @@ char * WARN_UNUSED_RESULT spv_legacy_data_decode (const uint8_t *in, size_t size, struct spv_data *out) { char *error = NULL; - memset (out, 0, sizeof *out); + *out = (struct spv_data) SPV_DATA_INITIALIZER; struct spvbin_input input; spvbin_input_init (&input, in, size); @@ -347,7 +347,7 @@ spv_legacy_data_decode (const uint8_t *in, size_t size, struct spv_data *out) goto error; } - out->sources = xcalloc (lb->n_sources, sizeof *out->sources); + out->sources = XCALLOC (lb->n_sources, struct spv_data_source); out->n_sources = lb->n_sources; for (size_t i = 0; i < lb->n_sources; i++) @@ -360,7 +360,7 @@ spv_legacy_data_decode (const uint8_t *in, size_t size, struct spv_data *out) source->n_values = md->n_values; source->vars = xcalloc (md->n_variables, sizeof *source->vars); - size_t end; + size_t end = -1; error = decode_data (in, size, md->data_offset, source, &end); if (error) goto error; @@ -394,7 +394,7 @@ spv_legacy_data_decode (const uint8_t *in, size_t size, struct spv_data *out) error: spv_data_uninit (out); - memset (out, 0, sizeof *out); + *out = (struct spv_data) SPV_DATA_INITIALIZER; spvob_free_legacy_binary (lb); return error; }