Fossil SCM

Avoid unnecessarily allocating a UUID when manifest_parse() fails and is not given an error blob.

stephan 2026-06-18 12:12 UTC trunk
Commit 07592007ce0a9233fab8b45c8be9dfcf56bfb6e1b43ded31cb6a4f1046af9331
1 file changed +3 -7
+3 -7
--- src/manifest.c
+++ src/manifest.c
@@ -1128,20 +1128,16 @@
11281128
md5sum_init();
11291129
if( !isRepeat ) g.parseCnt[p->type]++;
11301130
return p;
11311131
11321132
manifest_syntax_error:
1133
- {
1134
- char *zUuid = rid_to_uuid(rid);
1133
+ if(pErr!=0){
1134
+ char *zUuid = rid>0 ? rid_to_uuid(rid) : 0;
11351135
if( zUuid ){
1136
- if(pErr!=0){
1137
- blob_appendf(pErr, "artifact [%s] ", zUuid);
1138
- }
1136
+ blob_appendf(pErr, "artifact [%s] ", zUuid);
11391137
fossil_free(zUuid);
11401138
}
1141
- }
1142
- if(pErr!=0){
11431139
if( zErr ){
11441140
blob_appendf(pErr, "line %d: %s", lineNo, zErr);
11451141
}else{
11461142
blob_appendf(pErr, "unknown error on line %d", lineNo);
11471143
}
11481144
--- src/manifest.c
+++ src/manifest.c
@@ -1128,20 +1128,16 @@
1128 md5sum_init();
1129 if( !isRepeat ) g.parseCnt[p->type]++;
1130 return p;
1131
1132 manifest_syntax_error:
1133 {
1134 char *zUuid = rid_to_uuid(rid);
1135 if( zUuid ){
1136 if(pErr!=0){
1137 blob_appendf(pErr, "artifact [%s] ", zUuid);
1138 }
1139 fossil_free(zUuid);
1140 }
1141 }
1142 if(pErr!=0){
1143 if( zErr ){
1144 blob_appendf(pErr, "line %d: %s", lineNo, zErr);
1145 }else{
1146 blob_appendf(pErr, "unknown error on line %d", lineNo);
1147 }
1148
--- src/manifest.c
+++ src/manifest.c
@@ -1128,20 +1128,16 @@
1128 md5sum_init();
1129 if( !isRepeat ) g.parseCnt[p->type]++;
1130 return p;
1131
1132 manifest_syntax_error:
1133 if(pErr!=0){
1134 char *zUuid = rid>0 ? rid_to_uuid(rid) : 0;
1135 if( zUuid ){
1136 blob_appendf(pErr, "artifact [%s] ", zUuid);
 
 
1137 fossil_free(zUuid);
1138 }
 
 
1139 if( zErr ){
1140 blob_appendf(pErr, "line %d: %s", lineNo, zErr);
1141 }else{
1142 blob_appendf(pErr, "unknown error on line %d", lineNo);
1143 }
1144

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button