cmData.h/c : Changed cmDataRecdAllocXXX() to return a cmDtRC_t.
This commit is contained in:
parent
86f64739e4
commit
d92465cb37
42
cmData.c
42
cmData.c
@ -2146,46 +2146,60 @@ cmDtRC_t _cmDataRecdParseInputV(cmData_t* parent, cmErr_t* err, cmRC_t errRC, u
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmData_t* cmDataRecdAllocLabelV( cmData_t* parent, cmErr_t* err, cmRC_t errRC, va_list vl )
|
cmDtRC_t cmDataRecdAllocLabelV( cmData_t* parent, cmErr_t* err, cmRC_t errRC, cmData_t** ref, va_list vl )
|
||||||
{
|
{
|
||||||
cmData_t* p = cmDataRecdAlloc(parent);
|
cmData_t* p = cmDataRecdAlloc(parent);
|
||||||
|
if( ref != NULL )
|
||||||
|
*ref = NULL;
|
||||||
|
|
||||||
cmDtRC_t rc = _cmDataRecdParseInputV(p, err, errRC, false, vl );
|
cmDtRC_t rc = _cmDataRecdParseInputV(p, err, errRC, false, vl );
|
||||||
if( rc != kOkDtRC )
|
if( rc != kOkDtRC )
|
||||||
{
|
{
|
||||||
cmDataFree(p);
|
cmDataFree(p);
|
||||||
p = NULL;
|
p = NULL;
|
||||||
}
|
}
|
||||||
return p;
|
|
||||||
|
if( ref != NULL )
|
||||||
|
*ref = p;
|
||||||
|
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmData_t* cmDataRecdAllocLabelA( cmData_t* parent, cmErr_t* err, cmRC_t errRC, ... )
|
cmDtRC_t cmDataRecdAllocLabelA( cmData_t* parent, cmErr_t* err, cmRC_t errRC, cmData_t** ref, ... )
|
||||||
{
|
{
|
||||||
va_list vl;
|
va_list vl;
|
||||||
va_start(vl,errRC);
|
va_start(vl,ref);
|
||||||
cmData_t* p = cmDataRecdAllocLabelV(parent,err,errRC,vl);
|
cmDtRC_t rc = cmDataRecdAllocLabelV(parent,err,errRC,ref,vl);
|
||||||
va_end(vl);
|
va_end(vl);
|
||||||
return p;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmData_t* cmDataRecdAllocIdV( cmData_t* parent, cmErr_t* err, cmRC_t errRC, va_list vl )
|
cmDtRC_t cmDataRecdAllocIdV( cmData_t* parent, cmErr_t* err, cmRC_t errRC, cmData_t** ref, va_list vl )
|
||||||
{
|
{
|
||||||
cmData_t* p = cmDataRecdAlloc(parent);
|
cmData_t* p = cmDataRecdAlloc(parent);
|
||||||
|
if( ref != NULL )
|
||||||
|
*ref = NULL;
|
||||||
|
|
||||||
cmDtRC_t rc = _cmDataRecdParseInputV(p, err, errRC, true, vl );
|
cmDtRC_t rc = _cmDataRecdParseInputV(p, err, errRC, true, vl );
|
||||||
if( rc != kOkDtRC )
|
if( rc != kOkDtRC )
|
||||||
{
|
{
|
||||||
cmDataFree(p);
|
cmDataFree(p);
|
||||||
p = NULL;
|
p = NULL;
|
||||||
}
|
}
|
||||||
return p;
|
|
||||||
|
if( ref != NULL )
|
||||||
|
*ref = p;
|
||||||
|
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmData_t* cmDataRecdAllocIdA( cmData_t* parent, cmErr_t* err, cmRC_t errRC, ... )
|
cmDtRC_t cmDataRecdAllocIdA( cmData_t* parent, cmErr_t* err, cmRC_t errRC, cmData_t** ref, ... )
|
||||||
{
|
{
|
||||||
va_list vl;
|
va_list vl;
|
||||||
va_start(vl,errRC);
|
va_start(vl,ref);
|
||||||
cmData_t* p = cmDataRecdAllocIdV(parent,err,errRC,vl);
|
cmRC_t rc = cmDataRecdAllocIdV(parent,err,errRC,ref,vl);
|
||||||
va_end(vl);
|
va_end(vl);
|
||||||
return p;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmDtRC_t _cmDataRecdParseErrV( cmErr_t* err, unsigned rc, unsigned id, const cmChar_t* label, const cmChar_t* fmt, va_list vl )
|
cmDtRC_t _cmDataRecdParseErrV( cmErr_t* err, unsigned rc, unsigned id, const cmChar_t* label, const cmChar_t* fmt, va_list vl )
|
||||||
@ -3348,7 +3362,9 @@ void cmDataTest( cmCtx_t* ctx )
|
|||||||
if( cmDataParserTest(ctx) != kOkDtRC )
|
if( cmDataParserTest(ctx) != kOkDtRC )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
cmData_t* d0 = cmDataRecdAllocLabelA(NULL,&ctx->err,0,
|
cmData_t* d0 = NULL;
|
||||||
|
|
||||||
|
cmDataRecdAllocLabelA(NULL,&ctx->err,0,&d0,
|
||||||
"name", kStrDtId,"This is a string.",
|
"name", kStrDtId,"This is a string.",
|
||||||
"id", kUIntDtId, 21,
|
"id", kUIntDtId, 21,
|
||||||
"real",kFloatDtId, 1.23,
|
"real",kFloatDtId, 1.23,
|
||||||
|
8
cmData.h
8
cmData.h
@ -631,11 +631,11 @@ extern "C" {
|
|||||||
// call.
|
// call.
|
||||||
// 3) The cmDataRecdAllocLabelV() arg. list should be terminated with NULL.
|
// 3) The cmDataRecdAllocLabelV() arg. list should be terminated with NULL.
|
||||||
// The cmDataRecdAllocIdV() arg. list should be terminated with 'kInvalidDtId'.
|
// The cmDataRecdAllocIdV() arg. list should be terminated with 'kInvalidDtId'.
|
||||||
cmData_t* cmDataRecdAllocLabelV( cmData_t* parent, cmErr_t* err, cmRC_t errRC, va_list vl );
|
cmDtRC_t cmDataRecdAllocLabelV( cmData_t* parent, cmErr_t* err, cmRC_t errRC, cmData_t** ref, va_list vl );
|
||||||
cmData_t* cmDataRecdAllocLabelA( cmData_t* parent, cmErr_t* err, cmRC_t errRC, ... );
|
cmDtRC_t cmDataRecdAllocLabelA( cmData_t* parent, cmErr_t* err, cmRC_t errRC, cmData_t** ref, ... );
|
||||||
|
|
||||||
cmData_t* cmDataRecdAllocIdV( cmData_t* parent, cmErr_t* err, cmRC_t errRC, va_list vl );
|
cmDtRC_t cmDataRecdAllocIdV( cmData_t* parent, cmErr_t* err, cmRC_t errRC, cmData_t** ref, va_list vl );
|
||||||
cmData_t* cmDataRecdAllocIdA( cmData_t* parent, cmErr_t* err, cmRC_t errRC, ... );
|
cmDtRC_t cmDataRecdAllocIdA( cmData_t* parent, cmErr_t* err, cmRC_t errRC, cmData_t** ref, ... );
|
||||||
|
|
||||||
// Extract the data in a record to C variables.
|
// Extract the data in a record to C variables.
|
||||||
// Var-args format:
|
// Var-args format:
|
||||||
|
Loading…
Reference in New Issue
Block a user