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

This commit is contained in:
kevin 2013-03-21 08:18:46 -07:00
parent c7abab867e
commit 56e192c00e
2 changed files with 6 additions and 4 deletions

View File

@ -1337,6 +1337,7 @@ cmPrRC_t _cmPrefsCreateJsonNode(
pnp->id = _cmPrefsCalcNextAvailId(p); pnp->id = _cmPrefsCalcNextAvailId(p);
else else
{ {
if( existsFl == false )
if( _cmPrefsIdToNodePtr(p, id, false ) != NULL ) if( _cmPrefsIdToNodePtr(p, id, false ) != NULL )
cmErrWarnMsg(&p->err,kDuplicateIdPrRC,"The preference variable id '%i' is used by multiple preference variables including '%s'.",id,cmStringNullGuard(pathString)); cmErrWarnMsg(&p->err,kDuplicateIdPrRC,"The preference variable id '%i' is used by multiple preference variables including '%s'.",id,cmStringNullGuard(pathString));

View File

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