Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make included function definitions static #74

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions ModelicaCompliance/Resources/Include/ExtObj.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "ExtObj.h"

/* Constructor for MyTable. */
static
void* initMyTable(double *table_data, size_t table_size)
{
MyTable *table = (MyTable*)malloc(sizeof(MyTable));
Expand All @@ -25,7 +26,7 @@ void* initMyTable(double *table_data, size_t table_size)
free(table);
ModelicaError("Error allocating array in MyTable.\n");
return 0; /* Not reachable */
}
}

memcpy(table->array, table_data, table_size * sizeof(double));
table->size = table_size;
Expand All @@ -34,15 +35,17 @@ void* initMyTable(double *table_data, size_t table_size)
}

/* Destructor for MyTable. */
static
void closeMyTable(void *object)
{
MyTable *table = (MyTable*)object;
if (object == NULL) return;
free(table->array);
free(table);
}
}

/* Interpolates between two adjacent values in the table. */
static
double interpolateMyTable(void *object, double u)
{
MyTable *table = (MyTable*)object;
Expand Down
6 changes: 3 additions & 3 deletions ModelicaCompliance/Resources/Include/ExtObj.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ typedef struct {
unsigned size;
} MyTable;

void* initMyTable(double *table_data, size_t table_size);
void closeMyTable(void* object);
double interpolateMyTable(void* object, double u);
static void* initMyTable(double *table_data, size_t table_size);
static void closeMyTable(void* object);
static double interpolateMyTable(void* object, double u);

#endif /*EXTOBJ_H*/