From 7048d64c8bcf0fef6461d4aecc27701de1f47131 Mon Sep 17 00:00:00 2001
From: obarun <eric@obarun.org>
Date: Fri, 19 Jun 2020 18:29:35 +1100
Subject: [PATCH] avoid multiple same name at contents field

---
 src/lib66/parser_module.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/lib66/parser_module.c b/src/lib66/parser_module.c
index 27e89e82..322c0196 100644
--- a/src/lib66/parser_module.c
+++ b/src/lib66/parser_module.c
@@ -340,12 +340,14 @@ int parse_module(sv_alltype *sv_before,ssexec_t *info,stralloc *parsed_list,stra
 		svtype = get_svtype_from_file(sv) ;
 		if (svtype == -1) log_warnu_return(LOG_EXIT_ZERO,"get svtype of: ",sv) ;
 
-		if (!stralloc_catb(&sdir,pbname,strlen(pbname) + 1))
-			log_warnsys_return(LOG_EXIT_ZERO,"stralloc") ;
-
-		if (svtype != TYPE_CLASSIC)
-			if (!stralloc_catb(&tmp,pbname,strlen(pbname) + 1)) 
+		if (sastr_cmp(&sdir,pbname) == -1)
+			if (!stralloc_catb(&sdir,pbname,strlen(pbname) + 1))
 				log_warnsys_return(LOG_EXIT_ZERO,"stralloc") ;
+
+		if (sastr_cmp(&tmp,pbname) == -1)
+			if (svtype != TYPE_CLASSIC)
+				if (!stralloc_catb(&tmp,pbname,strlen(pbname) + 1))
+					log_warnsys_return(LOG_EXIT_ZERO,"stralloc") ;
 	}
 
 	sv_before->cname.idga = deps.len ;
-- 
GitLab