git » fp-git.git » commit 72892f1

improving common factors for all attributes

author ecalot
2006-01-05 23:53:22 UTC
committer ecalot
2006-01-05 23:53:22 UTC
parent 2c08fa025143bad4d4ca4739f094ecdcb6553218

improving common factors for all attributes

PR/src/lib/xml/search.c +4 -4
PR/src/lib/xml/tree.c +3 -1
PR/src/lib/xml/unknown.c +1 -3

diff --git a/PR/src/lib/xml/search.c b/PR/src/lib/xml/search.c
index 54bf421..dea366d 100644
--- a/PR/src/lib/xml/search.c
+++ b/PR/src/lib/xml/search.c
@@ -49,7 +49,7 @@ search.c: Princed Resources : specific xml handling functions
 \***************************************************************/
 
 /* parse file */
-int parseFile(const char* vFile, const char* datFile, tResourceList *r) {
+int parseFile(const char* vFile, const char* datFile, tResourceList *rlist) {
 	/* Declare error variable */
 	int error;
 	tPassWork pass;
@@ -60,7 +60,7 @@ int parseFile(const char* vFile, const char* datFile, tResourceList *r) {
 
 	/* Use the xml structure to Generate the resource structure of the file */
 	pass.datFile=datFile;
-	pass.r=r;
+	pass.rlist=rlist;
 	workTree(structure,&pass,workTag);
 
 	/* All done */
@@ -105,7 +105,7 @@ void workTag(const tTag* t,void* pass) {
 
 	/* Declare variables */
 	const char* datFile=((tPassWork*)pass)->datFile;
-	tResourceList* r=((tPassWork*)pass)->r;
+	tResourceList* rlist=((tPassWork*)pass)->rlist;
 	tResource res;
 	char* end;
 
@@ -149,7 +149,7 @@ void workTag(const tTag* t,void* pass) {
 	keepStringAttribute(name);  /* only for plv */
 	keepStringAttribute(path);
 
-	resourceListAdd(r,&res);
+	resourceListAdd(rlist,&res);
 }
 
 void workTree(const tTag* t,void* pass, void (*function)(const tTag*,void*)) {
diff --git a/PR/src/lib/xml/tree.c b/PR/src/lib/xml/tree.c
index d8bd223..85d6029 100644
--- a/PR/src/lib/xml/tree.c
+++ b/PR/src/lib/xml/tree.c
@@ -167,7 +167,9 @@ void resourceTreeCommonFactor(tTag* tag) {
 #ifndef DEBUG_CF
 void test() {
 	tTag tr[100];
-	memset(tr,sizeof(tr),0);
+	int i;
+	for (i=0;i<6800;i++) ((char*)tr)[i]=0;
+/*	memset(tr,0,100*sizeof(tTag*));*/
 
 	tr[0].child=&(tr[1]);
 
diff --git a/PR/src/lib/xml/unknown.c b/PR/src/lib/xml/unknown.c
index 26953a7..940a496 100644
--- a/PR/src/lib/xml/unknown.c
+++ b/PR/src/lib/xml/unknown.c
@@ -94,8 +94,6 @@ int unknownLogStart (const char* file,int optionflag, const char* backupExtensio
 	return PR_RESULT_SUCCESS; /* Ok */
 }
 
-#define eliminatecommonfactors(a) if (a) resourceTreeCommonFactor(a->child) /* this ignores the first tag (resources) */
-
 int unknownLogStop () {
 	int i;
 	tTag* t;
@@ -103,7 +101,7 @@ int unknownLogStop () {
 	if (!unknownFile.fd) return PR_RESULT_ERR_XML_NOT_OPEN; /* File not open */
 
 	/* common factor tree reducing function */
-	eliminatecommonfactors(unknownFile.tree);
+	if (unknownFile.tree) resourceTreeCommonFactor(unknownFile.tree->child);
 
 	/* it is time to fix the inheritances */
 	resourceTreeFixInheritances(&unknownFile.tree);