Skip to content

Commit

Permalink
refactor newly added functions
Browse files Browse the repository at this point in the history
  • Loading branch information
attipaci committed Dec 9, 2024
1 parent 627bcb0 commit b8e16a4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions include/xchange.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,8 @@ XField *xCreateLongField(const char *name, long long value);
XField *xCreateBooleanField(const char *name, boolean value);
XField *xCreateStringField(const char *name, const char *value);
XField *xCreate1DField(const char *name, XType type, int count, const void *values);
XField *xCreateFieldArray(const char *name, int ndim, const int *sizes);
XField *xCreate1DFieldArray(const char *name, int size);
XField *xCreateHeterogeneousArrayField(const char *name, int ndim, const int *sizes);
XField *xCreateHeterogeneous1DField(const char *name, int size);

// Parsers / formatters
boolean xParseBoolean(char *str, char **end);
Expand Down
10 changes: 7 additions & 3 deletions src/xstruct.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ XStructure *xCreateStruct() {
* @return A field containing a heterogeneous array of entries, or NULL if there
* was an error. The entries are initially empty, except for their names
* bearing '.' followed by the 1-based array index, e.g. '.1', '.2'...
*
* @sa xCreateHeterogeneous1DField()
*/
XField *xCreateFieldArray(const char *name, int ndim, const int *sizes) {
XField *xCreateHeterogeneousArrayField(const char *name, int ndim, const int *sizes) {
static const char *fn = "xCreateFieldArray";

int count = xGetElementCount(ndim, sizes);
Expand Down Expand Up @@ -82,10 +84,12 @@ XField *xCreateFieldArray(const char *name, int ndim, const int *sizes) {
* @return A field containing a heterogeneous array of entries, or NULL if there
* was an error. The entries are initially empty, except for their names
* bearing '.' followed by the 1-based array index, e.g. '.1', '.2'...
*
* @sa xCreateHeterogeneousArrayField()
*/
XField *xCreate1DFieldArray(const char *name, int size) {
XField *xCreateHeterogeneous1DField(const char *name, int size) {
const int sizes[X_MAX_DIMS] = { size };
return xCreateFieldArray(name, 1, sizes);
return xCreateHeterogeneousArrayField(name, 1, sizes);
}

/**
Expand Down

0 comments on commit b8e16a4

Please sign in to comment.