Skip to content

Commit b93e478

Browse files
committed
Changed GenericStack variables, function arguments and function return types from cJSON_ContainerType_t to cJSON_Generic_t.
1 parent 4382ad8 commit b93e478

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

inc/cJSON_GenericStack.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ typedef struct cJSON_GenericStack
126126
*/
127127
cJSON_depth_t stackSize;
128128
/**
129-
* @brief Index of the topmost cJSON_ContainerType_t of the stack. Is zero for both cases of the stack containing one and zero items!
129+
* @brief Index of the topmost cJSON_Generic_t of the stack. Is zero for both cases of the stack containing one and zero items!
130130
*
131131
*/
132132
cJSON_depth_t index;
@@ -136,10 +136,10 @@ typedef struct cJSON_GenericStack
136136
*/
137137
bool isEmpty;
138138
/**
139-
* @brief Pointer to a cJSON_ContainerType_t array.
139+
* @brief Pointer to a cJSON_Generic_t array.
140140
*
141141
*/
142-
cJSON_ContainerType_t *stack;
142+
cJSON_Generic_t *stack;
143143
} cJSON_GenericStack_t;
144144

145145
#pragma endregion
@@ -166,13 +166,13 @@ cJSON_GenericStack_t GS_Create(cJSON_depth_t stackSize);
166166
void GS_Delete(cJSON_GenericStack_t *TSptr);
167167

168168
/**
169-
* @brief Used to push a cJSON_ContainerType_t value to the stack.
169+
* @brief Used to push a cJSON_Generic_t value to the stack.
170170
*
171171
* @param TSptr Pointer to a cJSON_GenericStack_t struct.
172-
* @param type cJSON_ContainerType_t type that is to be pushed to the stack.
172+
* @param type cJSON_Generic_t type that is to be pushed to the stack.
173173
* @return cJSON_GenericStack_Result_t Returns GS_Ok by default. Returns GS_StackOverflow_Error if stack was already full before the push operation (type not pushed to stack).
174174
*/
175-
cJSON_GenericStack_Result_t GS_Push(cJSON_GenericStack_t *TSptr, cJSON_ContainerType_t type);
175+
cJSON_GenericStack_Result_t GS_Push(cJSON_GenericStack_t *TSptr, cJSON_Generic_t type);
176176
/**
177177
* @brief Used to remove the top item from the stack.
178178
*
@@ -184,10 +184,10 @@ cJSON_GenericStack_Result_t GS_Pop(cJSON_GenericStack_t *TSptr);
184184
* @brief Used to retreive the top value from the stack.
185185
*
186186
* @param TSptr Pointer to a cJSON_GenericStack_t struct.
187-
* @param type Pointer to a cJSON_ContainerType_t variable, the stack's top type is to be stored in.
188-
* @return cJSON_ContainerType_t Returns GS_Ok by default. Returns GS_StackIsEmpty if stack is empty (type pointer's contents are left untouched).
187+
* @param type Pointer to a cJSON_Generic_t variable, the stack's top type is to be stored in.
188+
* @return cJSON_Generic_t Returns GS_Ok by default. Returns GS_StackIsEmpty if stack is empty (type pointer's contents are left untouched).
189189
*/
190-
cJSON_GenericStack_Result_t GS_Top(cJSON_GenericStack_t *TSptr, cJSON_ContainerType_t *type);
190+
cJSON_GenericStack_Result_t GS_Top(cJSON_GenericStack_t *TSptr, cJSON_Generic_t *type);
191191
/**
192192
* @brief Function used to check if stack is empty.
193193
*

src/cJSON_GenericStack.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ cJSON_GenericStack_t GS_Create(cJSON_depth_t stackSize)
2222
tempTS.stackSize = stackSize;
2323
tempTS.index = 0;
2424
tempTS.isEmpty = true;
25-
tempTS.stack = (cJSON_ContainerType_t*)malloc(stackSize * sizeof(cJSON_ContainerType_t));
25+
tempTS.stack = (cJSON_Generic_t*)malloc(stackSize * sizeof(cJSON_Generic_t));
2626

2727
return tempTS;
2828
}
@@ -37,7 +37,7 @@ void GS_Delete(cJSON_GenericStack_t *TSptr)
3737
TSptr->isEmpty = true;
3838
}
3939

40-
cJSON_GenericStack_Result_t GS_Push(cJSON_GenericStack_t *TSptr, cJSON_ContainerType_t type)
40+
cJSON_GenericStack_Result_t GS_Push(cJSON_GenericStack_t *TSptr, cJSON_Generic_t type)
4141
{
4242
if (GS_PTR_IS_FULL(TSptr)) return GS_StackOverflow_Error;
4343
else if (GS_PTR_IS_EMPTY(TSptr))
@@ -68,7 +68,7 @@ cJSON_GenericStack_Result_t GS_Pop(cJSON_GenericStack_t *TSptr)
6868

6969
return GS_Ok;
7070
}
71-
cJSON_GenericStack_Result_t GS_Top(cJSON_GenericStack_t *TSptr, cJSON_ContainerType_t *type)
71+
cJSON_GenericStack_Result_t GS_Top(cJSON_GenericStack_t *TSptr, cJSON_Generic_t *type)
7272
{
7373
if (TSptr->isEmpty) return GS_StackIsEmpty;
7474
else

0 commit comments

Comments
 (0)