Merge branch 'master-amend' into 'master'

Mass renaming of symbols/functions

See merge request gem-graph/gem-graph-server!1
This commit is contained in:
Adrien Bourmault 2021-09-14 09:20:33 +00:00
commit d8f83d86c5
3 changed files with 34 additions and 32 deletions

View File

@ -140,7 +140,9 @@ static inline xmlNodePtr findWorkingRoot(const char *tagName,
}
if (cur->xmlChildrenNode) {
if ((recur = findRoot(tagName, cur->xmlChildrenNode)) != NULL)
if ((recur =
findWorkingRoot(tagName,
(xmlNodePtr)cur->xmlChildrenNode)) != NULL)
return recur;
}
@ -160,7 +162,7 @@ static inline int XmlParseTree(ModelField_t *curTree)
int curValueLen;
while (curTree) {
if (findRoot(
if (findWorkingRoot(
curTree->tag,
currentDocumentRoot->parent
) == NULL) {
@ -171,23 +173,24 @@ static inline int XmlParseTree(ModelField_t *curTree)
//printLog("Asked for %s\n", curTree->tag);
// Try to parse current tag
if (parseTag(curTree->tag, curTree->value, curTree->valueSize) != 0) {
if (XmlParseTag(curTree->tag, curTree->destination,
curTree->size) != 0) {
// There are values in that tag
if (curTree->value[0])
if (!(curTree->value[0] == '\0')) {
curValueLen = strlen(curTree->value);
if (curTree->destination[0])
if (!(curTree->destination[0] == '\0')) {
curValueLen = strlen(curTree->destination);
// Delete \n chars
for(int i = 0; i < curValueLen; i++) {
if(curTree->value[i] == '\n') {
memmove(&curTree->value[i],
&curTree->value[i+1],
if(curTree->destination[i] == '\n') {
memmove(&curTree->destination[i],
&curTree->destination[i+1],
curValueLen - i);
curValueLen--;
i--;
}
}
printLog("Field %s: %s\n", curTree->tag, curTree->value);
printLog("Field %s: %s\n", curTree->tag, curTree->destination);
}
} else {
// There aren't values in that tag
@ -199,7 +202,7 @@ static inline int XmlParseTree(ModelField_t *curTree)
}
if (curTree->son)
currentOrSonCorrectlyParsed |= parseTree(curTree->son);
currentOrSonCorrectlyParsed |= XmlParseTree(curTree->son);
curTree = curTree->next;
}

View File

@ -59,9 +59,9 @@ void CliDecorateMonitor(int signum)
const char infosSchedulerText[] = "Scheduler id";
const char infosScThreadsText[] = "+ threads ";
TermTermGetScreenSize(signum);
TermGetScreenSize(signum);
TermTermClearScreen();
TermClearScreen();
TermSetCursorLocation(1,1);
printf(C_COLOR_NORMAL C_COLOR_WHITE_ON_BLUE);
@ -261,7 +261,7 @@ void CliConnectedCommandLine(int sockfd)
);
TermRestoreCursorLocation();
moveCursorBackward();
TermMoveCursorBackward();
}
break;
@ -314,7 +314,7 @@ void CliConnectedCommandLine(int sockfd)
case KEY_ARROW_LEFT:
if (curPosition > 0) {
moveCursorBackward();
TermMoveCursorBackward();
curPosition--;
}
break;

View File

@ -175,7 +175,7 @@ int ModelStop(int id)
/* -------------------------------------------------------------------------- */
void ModelCreate(Model_t **newModel) // TODO manage deletion and empty slots
void ModelAddToKnown(Model_t **newModel) // TODO manage deletion and empty slots
{
// increment index
knownModelSize++;
@ -272,7 +272,7 @@ void ModelSystemInit(Parameters_t *parameters)
if ((extensionPosition = strstr(modelDirEntry->d_name, ".xml"))) {
// Creating model
ModelCreate(&newModel);
ModelAddToKnown(&newModel);
// Write file path in filename
strncpy(newModel->filename, parameters->modelDir,
@ -326,15 +326,15 @@ void ModelSystemDestroy(void)
static inline void CreateField(ModelField_t *modelField,
const char *tag,
const bool mandatory,
const char *value,
const size_t valueSize,
const ModelField_t *son,
const ModelField_t *next)
char *value,
size_t valueSize,
ModelField_t *son,
ModelField_t *next)
{
strncpy(modelField->tag, tag, 25);
modelField->mandatory = mandatory;
modelField->value = value;
modelField->valueSize = valueSize;
modelField->destination = value;
modelField->size = valueSize;
modelField->son = son;
modelField->next = next;
}
@ -371,30 +371,29 @@ static inline int ModelParseFile(Model_t *model)
"version", true, model->version, MAX_VERSION_SIZE, NULL, NULL);
CreateField(&parametersField,
"parameters", false, NULL, NULL, NULL, NULL);
"parameters", false, NULL, 0, NULL, NULL);
CreateField(&parametersModelizationField,
"modelization", false, NULL, NULL, NULL, NULL);
"modelization", false, NULL, 0, NULL, NULL);
CreateField(&parametersSpaceField,
"space", false, NULL, NULL, NULL, NULL);
"space", false, NULL, 0, NULL, NULL);
// TODO modify model according to things in file
printLog("Parsing model %s\n", model->name);
openCurrentDocument(model->filename);
XmlSetNewDocument(model->filename);
resetDocumentRoot();
XmlResetWorkingRoot();
if (parseTree(&identityField) != 0) {
XmlCloseCurrentDocument();
if (XmlParseTree(&identityField) != 0) {
printLog("Invalid document, parsing can't succeed!\n");
closeCurrentDocument();
return EBADF;
}
closeCurrentDocument();
// Interpret what needs to be
model->date = strtol(date, NULL, 0);