Browse Source

cmPrefs.h/c Check existsFl prior to signaling kDuplicateIdPrRC error in _cmPrefsCreateJsonNode().

master
kevin 11 years ago
parent
commit
56e192c00e
2 changed files with 6 additions and 4 deletions
  1. 3
    2
      cmPrefs.c
  2. 3
    2
      cmPrefs.h

+ 3
- 2
cmPrefs.c View File

@@ -1337,8 +1337,9 @@ cmPrRC_t  _cmPrefsCreateJsonNode(
1337 1337
     pnp->id = _cmPrefsCalcNextAvailId(p);
1338 1338
   else
1339 1339
   {
1340
-    if( _cmPrefsIdToNodePtr(p, id, false ) != NULL )
1341
-      cmErrWarnMsg(&p->err,kDuplicateIdPrRC,"The preference variable id '%i' is used by multiple preference variables including '%s'.",id,cmStringNullGuard(pathString));
1340
+    if( existsFl == false )
1341
+      if( _cmPrefsIdToNodePtr(p, id, false ) != NULL )
1342
+        cmErrWarnMsg(&p->err,kDuplicateIdPrRC,"The preference variable id '%i' is used by multiple preference variables including '%s'.",id,cmStringNullGuard(pathString));
1342 1343
   
1343 1344
     pnp->id = id;
1344 1345
   }

+ 3
- 2
cmPrefs.h View File

@@ -144,8 +144,9 @@ extern "C" {
144 144
   cmPrRC_t cmPrefsPathSetString( cmPrH_t h, const cmChar_t* pathStr, const cmChar_t* val );
145 145
 
146 146
   // Create a new preference variable and set it's value to 'val'.
147
-  // If a variable with the same path and type already exists and kForceValuePrFl is set then update it's value to 'val'.
148
-  // Note that in this case if kForceValuePrFl is not set then the function returns quietly.
147
+  // If a variable with the same path and type already exists and kForceValuePrFl
148
+  // is set then update it's value to 'val'. Note that in this case if
149
+  //  kForceValuePrFl is not set then the function returns quietly.
149 150
   //
150 151
   // If a variable with the same path but a different type exists then an error is returned.
151 152
   // 

Loading…
Cancel
Save