src/model.c: sanitize style

This commit is contained in:
Adrien Bourmault 2024-03-28 22:00:00 +02:00
parent 394d9644a0
commit 38cbe2a443
Signed by: neox
GPG Key ID: 95F65F55F682A17A
1 changed files with 6 additions and 3 deletions

View File

@ -49,7 +49,8 @@ struct model_t *knownModels = NULL;
*/ */
void model_populate_hashtable(xmlNode *node, void model_populate_hashtable(xmlNode *node,
xmlHashTablePtr hashTable, xmlHashTablePtr hashTable,
char *currentPath) { char *currentPath)
{
if (node == NULL) return; if (node == NULL) return;
// Skip text nodes and others that are not element nodes // Skip text nodes and others that are not element nodes
@ -83,7 +84,8 @@ void model_populate_hashtable(xmlNode *node,
* @param path The path to the tag, with '/' as the delimiter. * @param path The path to the tag, with '/' as the delimiter.
* @return The content of the tag at the end of the path, or NULL if not found. * @return The content of the tag at the end of the path, or NULL if not found.
*/ */
char* model_find_node_by_path(xmlNode *node, const char *path) { char* model_find_node_by_path(xmlNode *node, const char *path)
{
return (xmlNodePtr)xmlHashLookup(hashTable, (const xmlChar *)path); return (xmlNodePtr)xmlHashLookup(hashTable, (const xmlChar *)path);
} }
@ -97,7 +99,8 @@ char* model_find_node_by_path(xmlNode *node, const char *path) {
*/ */
int model_modify_node(xmlHashTablePtr hashTable, int model_modify_node(xmlHashTablePtr hashTable,
const char *path, const char *path,
const char *newContent) { const char *newContent)
{
xmlNodePtr node = model_find_node_by_path(hashTable, path); xmlNodePtr node = model_find_node_by_path(hashTable, path);
if (node) { if (node) {
// Free the current content of the node, if any // Free the current content of the node, if any