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,8 +1337,9 @@ cmPrRC_t _cmPrefsCreateJsonNode(
pnp->id = _cmPrefsCalcNextAvailId(p);
else
{
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));
if( existsFl == false )
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));
pnp->id = id;
}

View File

@ -144,8 +144,9 @@ extern "C" {
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'.
// If a variable with the same path and type already exists and kForceValuePrFl 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 and type already exists and kForceValuePrFl
// 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.
//