Skip to content

Commit

Permalink
Added ParserSubItems
Browse files Browse the repository at this point in the history
  • Loading branch information
ColumPaget committed Apr 8, 2023
1 parent fef1980 commit f281d44
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
18 changes: 10 additions & 8 deletions DataParser.c
Original file line number Diff line number Diff line change
Expand Up @@ -915,21 +915,22 @@ ListNode *ParserFindItem(ListNode *Items, const char *Name)
return(Node);
}

ListNode *ParserSubItems(ListNode *Node)
{
if (Node->ItemType == ITEM_STRING) return(NULL);
if (Node->ItemType == ITEM_INTEGER) return(NULL);
if (Node->ItemType == ITEM_ROOT) return(Node);
return((ListNode *) Node->Item);
}


ListNode *ParserOpenItem(ListNode *Items, const char *Name)
{
ListNode *Node;

Node=ParserFindItem(Items, Name);
if (Node)
{
if (Node->ItemType == ITEM_STRING) return(NULL);
if (Node->ItemType == ITEM_INTEGER) return(NULL);
if (Node->ItemType == ITEM_ROOT) return(Node);
return((ListNode *) Node->Item);
}
else return(NULL);
if (Node) return(ParserSubItems(Node));
return(NULL);
}


Expand All @@ -940,6 +941,7 @@ int ParserItemIsValue(ListNode *Node)
return(FALSE);
}


const char *ParserGetValue(ListNode *Items, const char *Name)
{
ListNode *Node;
Expand Down
1 change: 1 addition & 0 deletions DataParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ typedef struct lnode PARSER;
ListNode *ParserParseDocument(const char *DocType, const char *Doc);
void ParserItemsDestroy(ListNode *Items);
ListNode *ParserFindItem(ListNode *Items, const char *Name);
ListNode *ParserSubItems(ListNode *Node);
ListNode *ParserOpenItem(ListNode *Items, const char *Name);
int ParserItemIsValue(ListNode *Node);
const char *ParserGetValue(ListNode *Items, const char *Name);
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CC = gcc
VERSION = 5.1
VERSION = 5.2
CFLAGS = -g -O2
LDFLAGS=
LIBS = -lcap -lssl -lcrypto -lz -lc -lc -lc -lc
Expand Down
2 changes: 1 addition & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CC = @CC@
VERSION = 5.1
VERSION = 5.2
CFLAGS = @CFLAGS@ @SIMD_CFLAGS@
LDFLAGS=@LDFLAGS@
LIBS = @LIBS@
Expand Down

0 comments on commit f281d44

Please sign in to comment.