Skip to content

Commit f83ed2c

Browse files
Fixed loop logic.
Continue iterating when encountering invalid nodes.
1 parent ec85f37 commit f83ed2c

File tree

3 files changed

+3
-17
lines changed

3 files changed

+3
-17
lines changed

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ add_executable(DriverDefPaths
3838
${DriverDefPaths_SOURCE_FILES}
3939
)
4040
target_include_directories(DriverDefPaths PRIVATE
41-
${EXPAT_INCLUDE_DIRS}
4241
${DriverDefPaths_SOURCE_DIR}/Include
4342
)
4443
target_link_libraries(DriverDefPaths PUBLIC expat)

Source/Main.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,21 +107,18 @@ int main(int argc, char** argv) {
107107
xml_attribute* pPathAttribute = XmlNodeFindAttribute(pDriverPackageFileNode, "Path");
108108
xml_attribute* pNameAttribute = XmlNodeFindAttribute(pDriverPackageFileNode, "Name");
109109
if (!pPathAttribute || !pNameAttribute)
110-
break;
110+
continue;
111111

112112
char* sDriverPath = pPathAttribute->sContent;
113113
char* sDriverName = pNameAttribute->sContent;
114114
if (!sDriverPath || !sDriverName)
115-
break;
115+
continue;
116116

117117
// Remove "$(mspackageroot)".
118118
// "$(mspackageroot)" is always at the start of the path
119119
// because that's the only place it makes sense.
120120
size_t MprLength = strlen_literal("$(mspackageroot)");
121-
if (
122-
(strlen(sDriverPath) >= MprLength) &&
123-
(strncmp(sDriverPath, "$(mspackageroot)", MprLength) == 0)
124-
)
121+
if (strncmp(sDriverPath, "$(mspackageroot)", MprLength) == 0)
125122
sDriverPath += MprLength;
126123

127124
// Remove trailing backslash.

Source/XmlNode.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,6 @@ void XmlNodeFree(xml_node* pNode) {
5252
free(pNode);
5353
}
5454

55-
/*
56-
void XmlNodeSetContent(xml_node* pNode, const char* sContent) {
57-
assert(pNode != NULL);
58-
59-
size_t ContentSize = (strlen(sContent) + 1) * sizeof(*sContent);
60-
pNode->sContent = realloc_guarded(pNode->sContent, ContentSize);
61-
memcpy(pNode->sContent, sContent, ContentSize);
62-
}
63-
*/
64-
6555
void XmlNodeAddChildren(xml_node* pParentNode, xml_node* pChildrenNode) {
6656
assert(pParentNode != NULL);
6757
assert(pChildrenNode != NULL);

0 commit comments

Comments
 (0)