From 25fe6cbafa93a3c4eebe46fe9ffbf3d41903ab16 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Wed, 8 Oct 2003 13:11:50 -0500 Subject: [svn-r7574] Purpose: Code Improvement Description: Changed from passing a structure into a function by value into passing it in by pointer. Noticed this while compiling with a highly optimizing compiler which took >30 minutes to analyze the program (granted, this is the compiler's fault, but in general, it's better to pass large structures in by pointer and not by value). Platforms tested: Linux (specific to h5import, so only needed to test on one platform) Misc. update: --- tools/h5import/h5import.c | 56 +++++++++++++++++++++++------------------------ tools/h5import/h5import.h | 4 ++-- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/tools/h5import/h5import.c b/tools/h5import/h5import.c index a59098f..8e073fa 100755 --- a/tools/h5import/h5import.c +++ b/tools/h5import/h5import.c @@ -1849,18 +1849,18 @@ setDefaultValues(struct Input *in, int count) } hid_t -createOutputDataType(struct Input in) +createOutputDataType(struct Input *in) { hid_t new_type = (-1); const char *err1 = "Invalid value for output class.\n"; - switch (in.outputClass) + switch (in->outputClass) { case 0: - switch (in.outputArchitecture) + switch (in->outputArchitecture) { case 0: /* NATIVE */ - switch(in.outputSize) + switch(in->outputSize) { case 8: new_type = H5Tcopy (H5T_NATIVE_CHAR); @@ -1881,10 +1881,10 @@ createOutputDataType(struct Input in) break; case 1: /* STD */ - switch(in.outputSize) + switch(in->outputSize) { case 8: - switch(in.outputByteOrder) + switch(in->outputByteOrder) { case 0: new_type = H5Tcopy (H5T_STD_I8BE); @@ -1897,7 +1897,7 @@ createOutputDataType(struct Input in) break; case 16: - switch(in.outputByteOrder) + switch(in->outputByteOrder) { case 0: new_type = H5Tcopy (H5T_STD_I16BE); @@ -1910,7 +1910,7 @@ createOutputDataType(struct Input in) break; case 32: - switch(in.outputByteOrder) + switch(in->outputByteOrder) { case 0: new_type = H5Tcopy (H5T_STD_I32BE); @@ -1923,7 +1923,7 @@ createOutputDataType(struct Input in) break; case 64: - switch(in.outputByteOrder) + switch(in->outputByteOrder) { case 0: new_type = H5Tcopy (H5T_STD_I64BE); @@ -1941,10 +1941,10 @@ createOutputDataType(struct Input in) break; case 1: - switch (in.outputArchitecture) + switch (in->outputArchitecture) { case 0: - switch(in.outputSize) + switch(in->outputSize) { case 32: new_type = H5Tcopy (H5T_NATIVE_FLOAT); @@ -1961,10 +1961,10 @@ createOutputDataType(struct Input in) break; case 2: - switch(in.outputSize) + switch(in->outputSize) { case 32: - switch(in.outputByteOrder) + switch(in->outputByteOrder) { case 0: new_type = H5Tcopy (H5T_IEEE_F32BE); @@ -1977,7 +1977,7 @@ createOutputDataType(struct Input in) break; case 64: - switch(in.outputByteOrder) + switch(in->outputByteOrder) { case 0: new_type = H5Tcopy (H5T_IEEE_F64BE); @@ -1995,10 +1995,10 @@ createOutputDataType(struct Input in) break; case 2: - switch (in.outputArchitecture) + switch (in->outputArchitecture) { case 0: - switch(in.outputSize) + switch(in->outputSize) { case 8: new_type = H5Tcopy (H5T_NATIVE_UCHAR); @@ -2019,10 +2019,10 @@ createOutputDataType(struct Input in) break; case 1: - switch(in.outputSize) + switch(in->outputSize) { case 8: - switch(in.outputByteOrder) + switch(in->outputByteOrder) { case 0: new_type = H5Tcopy (H5T_STD_U8BE); @@ -2035,7 +2035,7 @@ createOutputDataType(struct Input in) break; case 16: - switch(in.outputByteOrder) + switch(in->outputByteOrder) { case 0: new_type = H5Tcopy (H5T_STD_U16BE); @@ -2048,7 +2048,7 @@ createOutputDataType(struct Input in) break; case 32: - switch(in.outputByteOrder) + switch(in->outputByteOrder) { case 0: new_type = H5Tcopy (H5T_STD_U32BE); @@ -2061,7 +2061,7 @@ createOutputDataType(struct Input in) break; case 64: - switch(in.outputByteOrder) + switch(in->outputByteOrder) { case 0: new_type = H5Tcopy (H5T_STD_U64BE); @@ -2091,16 +2091,16 @@ createOutputDataType(struct Input in) } hid_t -createInputDataType(struct Input in) +createInputDataType(struct Input *in) { hid_t new_type = (-1); const char *err1 = "Invalid value for input class.\n"; - switch (in.inputClass) + switch (in->inputClass) { case 0: case 4: - switch(in.inputSize) + switch(in->inputSize) { case 8: new_type = H5Tcopy (H5T_NATIVE_CHAR); @@ -2123,7 +2123,7 @@ createInputDataType(struct Input in) case 1: case 2: case 3: - switch(in.inputSize) + switch(in->inputSize) { case 32: new_type = H5Tcopy (H5T_NATIVE_FLOAT); @@ -2140,7 +2140,7 @@ createInputDataType(struct Input in) case 6: case 7: - switch(in.inputSize) + switch(in->inputSize) { case 8: new_type = H5Tcopy (H5T_NATIVE_UCHAR); @@ -2249,8 +2249,8 @@ process(struct Options *opt) } H5E_END_TRY; /*create data type */ - intype = createInputDataType(*in); - outtype = createOutputDataType(*in); + intype = createInputDataType(in); + outtype = createOutputDataType(in); /* create property list */ proplist = H5Pcreate (H5P_DATASET_CREATE); diff --git a/tools/h5import/h5import.h b/tools/h5import/h5import.h index 2f968b7..353e548 100755 --- a/tools/h5import/h5import.h +++ b/tools/h5import/h5import.h @@ -215,8 +215,8 @@ static int readIntegerData(FILE **strm, struct Input *in); static int readFloatData(FILE **strm, struct Input *in); static int allocateIntegerStorage(struct Input *in); static int allocateFloatStorage(struct Input *in); -hid_t createOutputDataType(struct Input in); -hid_t createInputDataType(struct Input in); +hid_t createOutputDataType(struct Input *in); +hid_t createInputDataType(struct Input *in); static int readUIntegerData(FILE **strm, struct Input *in); static int allocateUIntegerStorage(struct Input *in); static int validateConfigurationParameters(struct Input * in); -- cgit v0.12