summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ctok.c4
-rw-r--r--msg.c28
-rw-r--r--obj-types.h13
-rw-r--r--obj.c70
-rw-r--r--obj.h8
-rw-r--r--queue.c10
-rw-r--r--stream.c20
-rw-r--r--var.c37
-rw-r--r--var.h21
9 files changed, 107 insertions, 104 deletions
diff --git a/ctok.c b/ctok.c
index 8b88e1a2..66305171 100644
--- a/ctok.c
+++ b/ctok.c
@@ -179,7 +179,7 @@ static rsRetVal
ctokGetNumber(ctok_t *pThis, ctok_token_t *pToken)
{
DEFiRet;
- int64 n; /* the parsed number */
+ number_t n; /* the parsed number */
uchar c;
int valC;
int iBase;
@@ -228,7 +228,7 @@ ctokGetNumber(ctok_t *pThis, ctok_token_t *pToken)
/* we need to unget the character that made the loop terminate */
CHKiRet(ctokUngetCharFromStream(pThis, c));
- CHKiRet(var.SetInt64(pToken->pVar, n));
+ CHKiRet(var.SetNumber(pToken->pVar, n));
dbgprintf("number, number is: '%lld'\n", n);
diff --git a/msg.c b/msg.c
index 1241151e..5a271580 100644
--- a/msg.c
+++ b/msg.c
@@ -2089,33 +2089,33 @@ rsRetVal MsgSetProperty(msg_t *pThis, var_t *pProp)
assert(pProp != NULL);
if(isProp("iProtocolVersion")) {
- setProtocolVersion(pThis, pProp->val.vShort);
+ setProtocolVersion(pThis, pProp->val.num);
} else if(isProp("iSeverity")) {
- pThis->iSeverity = pProp->val.vShort;
+ pThis->iSeverity = pProp->val.num;
} else if(isProp("iFacility")) {
- pThis->iFacility = pProp->val.vShort;
+ pThis->iFacility = pProp->val.num;
} else if(isProp("msgFlags")) {
- pThis->msgFlags = pProp->val.vInt;
+ pThis->msgFlags = pProp->val.num;
} else if(isProp("pszRawMsg")) {
- MsgSetRawMsg(pThis, (char*) rsCStrGetSzStrNoNULL(pProp->val.vpCStr));
+ MsgSetRawMsg(pThis, (char*) rsCStrGetSzStrNoNULL(pProp->val.pStr));
} else if(isProp("pszMSG")) {
- MsgSetMSG(pThis, (char*) rsCStrGetSzStrNoNULL(pProp->val.vpCStr));
+ MsgSetMSG(pThis, (char*) rsCStrGetSzStrNoNULL(pProp->val.pStr));
} else if(isProp("pszUxTradMsg")) {
- MsgSetUxTradMsg(pThis, (char*) rsCStrGetSzStrNoNULL(pProp->val.vpCStr));
+ MsgSetUxTradMsg(pThis, (char*) rsCStrGetSzStrNoNULL(pProp->val.pStr));
} else if(isProp("pszTAG")) {
- MsgSetTAG(pThis, (char*) rsCStrGetSzStrNoNULL(pProp->val.vpCStr));
+ MsgSetTAG(pThis, (char*) rsCStrGetSzStrNoNULL(pProp->val.pStr));
} else if(isProp("pszRcvFrom")) {
- MsgSetHOSTNAME(pThis, (char*) rsCStrGetSzStrNoNULL(pProp->val.vpCStr));
+ MsgSetHOSTNAME(pThis, (char*) rsCStrGetSzStrNoNULL(pProp->val.pStr));
} else if(isProp("pszHOSTNAME")) {
- MsgSetRcvFrom(pThis, (char*) rsCStrGetSzStrNoNULL(pProp->val.vpCStr));
+ MsgSetRcvFrom(pThis, (char*) rsCStrGetSzStrNoNULL(pProp->val.pStr));
} else if(isProp("pCSStrucData")) {
- MsgSetStructuredData(pThis, (char*) rsCStrGetSzStrNoNULL(pProp->val.vpCStr));
+ MsgSetStructuredData(pThis, (char*) rsCStrGetSzStrNoNULL(pProp->val.pStr));
} else if(isProp("pCSAPPNAME")) {
- MsgSetAPPNAME(pThis, (char*) rsCStrGetSzStrNoNULL(pProp->val.vpCStr));
+ MsgSetAPPNAME(pThis, (char*) rsCStrGetSzStrNoNULL(pProp->val.pStr));
} else if(isProp("pCSPROCID")) {
- MsgSetPROCID(pThis, (char*) rsCStrGetSzStrNoNULL(pProp->val.vpCStr));
+ MsgSetPROCID(pThis, (char*) rsCStrGetSzStrNoNULL(pProp->val.pStr));
} else if(isProp("pCSMSGID")) {
- MsgSetMSGID(pThis, (char*) rsCStrGetSzStrNoNULL(pProp->val.vpCStr));
+ MsgSetMSGID(pThis, (char*) rsCStrGetSzStrNoNULL(pProp->val.pStr));
} else if(isProp("tRcvdAt")) {
memcpy(&pThis->tRcvdAt, &pProp->val.vSyslogTime, sizeof(struct syslogTime));
} else if(isProp("tTIMESTAMP")) {
diff --git a/obj-types.h b/obj-types.h
index ee82c49f..577b93f2 100644
--- a/obj-types.h
+++ b/obj-types.h
@@ -31,6 +31,19 @@
#include "stringbuf.h"
#include "syslogd-types.h"
+/* property types for obj[De]Serialize() */
+typedef enum {
+ PROPTYPE_NONE = 0, /* currently no value set */
+ PROPTYPE_PSZ = 1,
+ PROPTYPE_SHORT = 2,
+ PROPTYPE_INT = 3,
+ PROPTYPE_LONG = 4,
+ PROPTYPE_INT64 = 5,
+ PROPTYPE_CSTR = 6,
+ PROPTYPE_SYSLOGTIME = 7
+} propType_t;
+
+
/* object Types/IDs */
typedef enum { /* IDs of known object "types/classes" */
OBJNull = 0, /* no valid object (we do not start at zero so we can detect calloc()) */
diff --git a/obj.c b/obj.c
index 4177f3ae..f0ad9787 100644
--- a/obj.c
+++ b/obj.c
@@ -216,12 +216,13 @@ finalize_it:
/* append a property
*/
-rsRetVal objSerializeProp(strm_t *pStrm, uchar *pszPropName, varType_t propType, void *pUsr)
+rsRetVal objSerializeProp(strm_t *pStrm, uchar *pszPropName, propType_t propType, void *pUsr)
{
DEFiRet;
uchar *pszBuf = NULL;
size_t lenBuf = 0;
uchar szBuf[64];
+ varType_t vType = VARTYPE_NONE;
ISOBJ_TYPE_assert(pStrm, strm);
assert(pszPropName != NULL);
@@ -238,30 +239,35 @@ rsRetVal objSerializeProp(strm_t *pStrm, uchar *pszPropName, varType_t propType,
/* TODO: use the stream functions for data conversion here - should be quicker */
switch(propType) {
- case VARTYPE_PSZ:
+ case PROPTYPE_PSZ:
pszBuf = (uchar*) pUsr;
lenBuf = strlen((char*) pszBuf);
+ vType = VARTYPE_STR;
break;
- case VARTYPE_SHORT:
+ case PROPTYPE_SHORT:
CHKiRet(srUtilItoA((char*) szBuf, sizeof(szBuf), (long) *((short*) pUsr)));
pszBuf = szBuf;
lenBuf = strlen((char*) szBuf);
+ vType = VARTYPE_NUMBER;
break;
- case VARTYPE_INT:
+ case PROPTYPE_INT:
CHKiRet(srUtilItoA((char*) szBuf, sizeof(szBuf), (long) *((int*) pUsr)));
pszBuf = szBuf;
lenBuf = strlen((char*) szBuf);
+ vType = VARTYPE_NUMBER;
break;
- case VARTYPE_LONG:
+ case PROPTYPE_LONG:
CHKiRet(srUtilItoA((char*) szBuf, sizeof(szBuf), *((long*) pUsr)));
pszBuf = szBuf;
lenBuf = strlen((char*) szBuf);
+ vType = VARTYPE_NUMBER;
break;
- case VARTYPE_CSTR:
+ case PROPTYPE_CSTR:
pszBuf = rsCStrGetSzStrNoNULL((cstr_t *) pUsr);
lenBuf = rsCStrLen((cstr_t*) pUsr);
+ vType = VARTYPE_STR;
break;
- case VARTYPE_SYSLOGTIME:
+ case PROPTYPE_SYSLOGTIME:
lenBuf = snprintf((char*) szBuf, sizeof(szBuf), "%d:%d:%d:%d:%d:%d:%d:%d:%d:%c:%d:%d",
((syslogTime_t*)pUsr)->timeType,
((syslogTime_t*)pUsr)->year,
@@ -277,6 +283,7 @@ rsRetVal objSerializeProp(strm_t *pStrm, uchar *pszPropName, varType_t propType,
((syslogTime_t*)pUsr)->OffsetMinute);
if(lenBuf > sizeof(szBuf) - 1)
ABORT_FINALIZE(RS_RET_PROVIDED_BUFFER_TOO_SMALL);
+ vType = VARTYPE_SYSLOGTIME;
pszBuf = szBuf;
break;
default:
@@ -290,7 +297,7 @@ rsRetVal objSerializeProp(strm_t *pStrm, uchar *pszPropName, varType_t propType,
CHKiRet(strmWrite(pStrm, pszPropName, strlen((char*)pszPropName)));
CHKiRet(strmWriteChar(pStrm, ':'));
/* type */
- CHKiRet(strmWriteLong(pStrm, (int) propType));
+ CHKiRet(strmWriteLong(pStrm, (int) vType));
CHKiRet(strmWriteChar(pStrm, ':'));
/* length */
CHKiRet(strmWriteLong(pStrm, lenBuf));
@@ -333,13 +340,13 @@ finalize_it:
#define NEXTC CHKiRet(strmReadChar(pStrm, &c))//;dbgprintf("c: %c\n", c);
/* de-serialize an (long) integer */
-static rsRetVal objDeserializeLong(long *pInt, strm_t *pStrm)
+static rsRetVal objDeserializeNumber(number_t *pNum, strm_t *pStrm)
{
DEFiRet;
- int i;
+ number_t i;
uchar c;
- assert(pInt != NULL);
+ assert(pNum != NULL);
NEXTC;
i = 0;
@@ -350,7 +357,7 @@ static rsRetVal objDeserializeLong(long *pInt, strm_t *pStrm)
if(c != ':') ABORT_FINALIZE(RS_RET_INVALID_DELIMITER);
- *pInt = i;
+ *pNum = i;
finalize_it:
RETiRet;
}
@@ -391,12 +398,12 @@ finalize_it:
/* de-serialize a syslogTime -- rgerhards,2008-01-08 */
#define GETVAL(var) \
- CHKiRet(objDeserializeLong(&l, pStrm)); \
+ CHKiRet(objDeserializeNumber(&l, pStrm)); \
pTime->var = l;
static rsRetVal objDeserializeSyslogTime(syslogTime_t *pTime, strm_t *pStrm)
{
DEFiRet;
- long l;
+ number_t l;
uchar c;
assert(pTime != NULL);
@@ -427,8 +434,8 @@ finalize_it:
static rsRetVal objDeserializeHeader(uchar *pszRecType, objID_t *poID, int* poVers, strm_t *pStrm)
{
DEFiRet;
- long ioID;
- long oVers;
+ number_t ioID;
+ number_t oVers;
uchar c;
assert(poID != NULL);
@@ -445,8 +452,8 @@ static rsRetVal objDeserializeHeader(uchar *pszRecType, objID_t *poID, int* poVe
NEXTC; if(c != ':') ABORT_FINALIZE(RS_RET_INVALID_HEADER_VERS);
/* object type and version */
- CHKiRet(objDeserializeLong(&ioID, pStrm));
- CHKiRet(objDeserializeLong(&oVers, pStrm));
+ CHKiRet(objDeserializeNumber(&ioID, pStrm));
+ CHKiRet(objDeserializeNumber(&oVers, pStrm));
if(ioID < 1 || ioID >= OBJ_NUM_IDS)
ABORT_FINALIZE(RS_RET_INVALID_OID);
@@ -470,8 +477,8 @@ finalize_it:
static rsRetVal objDeserializeProperty(var_t *pProp, strm_t *pStrm)
{
DEFiRet;
- long i;
- long iLen;
+ number_t i;
+ number_t iLen;
uchar c;
assert(pProp != NULL);
@@ -495,30 +502,19 @@ static rsRetVal objDeserializeProperty(var_t *pProp, strm_t *pStrm)
CHKiRet(rsCStrFinish(pProp->pcsName));
/* property type */
- CHKiRet(objDeserializeLong(&i, pStrm));
+ CHKiRet(objDeserializeNumber(&i, pStrm));
pProp->varType = i;
/* size (needed for strings) */
- CHKiRet(objDeserializeLong(&iLen, pStrm));
+ CHKiRet(objDeserializeNumber(&iLen, pStrm));
/* we now need to deserialize the value */
switch(pProp->varType) {
- case VARTYPE_PSZ:
- CHKiRet(objDeserializeStr(&pProp->val.vpCStr, iLen, pStrm));
- break;
- case VARTYPE_SHORT:
- CHKiRet(objDeserializeLong(&i, pStrm));
- pProp->val.vShort = i;
- break;
- case VARTYPE_INT:
- CHKiRet(objDeserializeLong(&i, pStrm));
- pProp->val.vInt = i;
- break;
- case VARTYPE_LONG:
- CHKiRet(objDeserializeLong(&pProp->val.vLong, pStrm));
+ case VARTYPE_STR:
+ CHKiRet(objDeserializeStr(&pProp->val.pStr, iLen, pStrm));
break;
- case VARTYPE_CSTR:
- CHKiRet(objDeserializeStr(&pProp->val.vpCStr, iLen, pStrm));
+ case VARTYPE_NUMBER:
+ CHKiRet(objDeserializeNumber(&pProp->val.num, pStrm));
break;
case VARTYPE_SYSLOGTIME:
CHKiRet(objDeserializeSyslogTime(&pProp->val.vSyslogTime, pStrm));
diff --git a/obj.h b/obj.h
index 516202ef..b73dff11 100644
--- a/obj.h
+++ b/obj.h
@@ -61,11 +61,11 @@
}
#define objSerializeSCALAR_VAR(strm, propName, propType, var) \
- CHKiRet(objSerializeProp(strm, (uchar*) #propName, VARTYPE_##propType, (void*) &var));
+ CHKiRet(objSerializeProp(strm, (uchar*) #propName, PROPTYPE_##propType, (void*) &var));
#define objSerializeSCALAR(strm, propName, propType) \
- CHKiRet(objSerializeProp(strm, (uchar*) #propName, VARTYPE_##propType, (void*) &pThis->propName));
+ CHKiRet(objSerializeProp(strm, (uchar*) #propName, PROPTYPE_##propType, (void*) &pThis->propName));
#define objSerializePTR(strm, propName, propType) \
- CHKiRet(objSerializeProp(strm, (uchar*) #propName, VARTYPE_##propType, (void*) pThis->propName));
+ CHKiRet(objSerializeProp(strm, (uchar*) #propName, PROPTYPE_##propType, (void*) pThis->propName));
#define DEFobjStaticHelpers static objInfo_t *pObjInfoOBJ = NULL;
#define objGetClassName(pThis) (((obj_t*) (pThis))->pObjInfo->pszName)
#define objGetObjID(pThis) (((obj_t*) (pThis))->pObjInfo->objID)
@@ -93,7 +93,7 @@ rsRetVal objDestructObjSelf(obj_t *pThis);
rsRetVal objInfoSetMethod(objInfo_t *pThis, objMethod_t objMethod, rsRetVal (*pHandler)(void*));
rsRetVal objBeginSerializePropBag(strm_t *pStrm, obj_t *pObj);
rsRetVal objBeginSerialize(strm_t *pStrm, obj_t *pObj);
-rsRetVal objSerializeProp(strm_t *pStrm, uchar *pszPropName, varType_t propType, void *pUsr);
+rsRetVal objSerializeProp(strm_t *pStrm, uchar *pszPropName, propType_t propType, void *pUsr);
rsRetVal objEndSerialize(strm_t *pStrm);
rsRetVal objRegisterObj(objID_t oID, objInfo_t *pInfo);
rsRetVal objDeserialize(void *ppObj, objID_t objTypeExpected, strm_t *pStrm, rsRetVal (*fFixup)(obj_t*,void*), void *pUsr);
diff --git a/queue.c b/queue.c
index 2c43e773..18ea416c 100644
--- a/queue.c
+++ b/queue.c
@@ -2066,15 +2066,15 @@ static rsRetVal queueSetProperty(queue_t *pThis, var_t *pProp)
ASSERT(pProp != NULL);
if(isProp("iQueueSize")) {
- pThis->iQueueSize = pProp->val.vInt;
+ pThis->iQueueSize = pProp->val.num;
} else if(isProp("iUngottenObjs")) {
- pThis->iUngottenObjs = pProp->val.vInt;
+ pThis->iUngottenObjs = pProp->val.num;
} else if(isProp("tVars.disk.sizeOnDisk")) {
- pThis->tVars.disk.sizeOnDisk = pProp->val.vLong;
+ pThis->tVars.disk.sizeOnDisk = pProp->val.num;
} else if(isProp("tVars.disk.bytesRead")) {
- pThis->tVars.disk.bytesRead = pProp->val.vLong;
+ pThis->tVars.disk.bytesRead = pProp->val.num;
} else if(isProp("qType")) {
- if(pThis->qType != pProp->val.vLong)
+ if(pThis->qType != pProp->val.num)
ABORT_FINALIZE(RS_RET_QTYPE_MISMATCH);
}
diff --git a/stream.c b/stream.c
index c622f331..b6be4da2 100644
--- a/stream.c
+++ b/stream.c
@@ -811,25 +811,25 @@ rsRetVal strmSetProperty(strm_t *pThis, var_t *pProp)
ASSERT(pProp != NULL);
if(isProp("sType")) {
- CHKiRet(strmSetsType(pThis, (strmType_t) pProp->val.vInt));
+ CHKiRet(strmSetsType(pThis, (strmType_t) pProp->val.num));
} else if(isProp("iCurrFNum")) {
- pThis->iCurrFNum = pProp->val.vInt;
+ pThis->iCurrFNum = pProp->val.num;
} else if(isProp("pszFName")) {
- CHKiRet(strmSetFName(pThis, rsCStrGetSzStrNoNULL(pProp->val.vpCStr), rsCStrLen(pProp->val.vpCStr)));
+ CHKiRet(strmSetFName(pThis, rsCStrGetSzStrNoNULL(pProp->val.pStr), rsCStrLen(pProp->val.pStr)));
} else if(isProp("tOperationsMode")) {
- CHKiRet(strmSettOperationsMode(pThis, pProp->val.vInt));
+ CHKiRet(strmSettOperationsMode(pThis, pProp->val.num));
} else if(isProp("tOpenMode")) {
- CHKiRet(strmSettOpenMode(pThis, pProp->val.vInt));
+ CHKiRet(strmSettOpenMode(pThis, pProp->val.num));
} else if(isProp("iCurrOffs")) {
- pThis->iCurrOffs = pProp->val.vLong;
+ pThis->iCurrOffs = pProp->val.num;
} else if(isProp("iMaxFileSize")) {
- CHKiRet(strmSetiMaxFileSize(pThis, pProp->val.vLong));
+ CHKiRet(strmSetiMaxFileSize(pThis, pProp->val.num));
} else if(isProp("iMaxFiles")) {
- CHKiRet(strmSetiMaxFiles(pThis, pProp->val.vInt));
+ CHKiRet(strmSetiMaxFiles(pThis, pProp->val.num));
} else if(isProp("iFileNumDigits")) {
- CHKiRet(strmSetiFileNumDigits(pThis, pProp->val.vInt));
+ CHKiRet(strmSetiFileNumDigits(pThis, pProp->val.num));
} else if(isProp("bDeleteOnClose")) {
- CHKiRet(strmSetbDeleteOnClose(pThis, pProp->val.vInt));
+ CHKiRet(strmSetbDeleteOnClose(pThis, pProp->val.num));
}
finalize_it:
diff --git a/var.c b/var.c
index 0c6c6e8b..d383a1a8 100644
--- a/var.c
+++ b/var.c
@@ -63,9 +63,9 @@ BEGINobjDestruct(var) /* be sure to specify the object type also in END and CODE
CODESTARTobjDestruct(var)
if(pThis->pcsName != NULL)
d_free(pThis->pcsName);
- if(pThis->varType == VARTYPE_CSTR) {
- if(pThis->val.vpCStr != NULL)
- d_free(pThis->val.vpCStr);
+ if(pThis->varType == VARTYPE_STR) {
+ if(pThis->val.pStr != NULL)
+ d_free(pThis->val.pStr);
}
ENDobjDestruct(var)
@@ -75,14 +75,11 @@ ENDobjDestruct(var)
BEGINobjDebugPrint(var) /* be sure to specify the object type also in END and CODESTART macros! */
CODESTARTobjDebugPrint(var)
switch(pThis->varType) {
- case VARTYPE_CSTR:
- dbgoprint((obj_t*) pThis, "type: cstr, val '%s'\n", rsCStrGetSzStr(pThis->val.vpCStr));
- break;
- case VARTYPE_INT64:
- dbgoprint((obj_t*) pThis, "type: int64, val %lld\n", pThis->val.vInt64);
+ case VARTYPE_STR:
+ dbgoprint((obj_t*) pThis, "type: cstr, val '%s'\n", rsCStrGetSzStr(pThis->val.pStr));
break;
- case VARTYPE_INT:
- dbgoprint((obj_t*) pThis, "type: int64, val %d\n", pThis->val.vInt);
+ case VARTYPE_NUMBER:
+ dbgoprint((obj_t*) pThis, "type: int64, val %lld\n", pThis->val.num);
break;
default:
dbgoprint((obj_t*) pThis, "type %d currently not suppored in debug output\n", pThis->varType);
@@ -99,8 +96,8 @@ varUnsetValues(var_t *pThis)
DEFiRet;
ISOBJ_TYPE_assert(pThis, var);
- if(pThis->varType == VARTYPE_CSTR)
- rsCStrDestruct(&pThis->val.vpCStr);
+ if(pThis->varType == VARTYPE_STR)
+ rsCStrDestruct(&pThis->val.pStr);
pThis->varType = VARTYPE_NONE;
@@ -113,15 +110,15 @@ varUnsetValues(var_t *pThis)
* has been called.
*/
static rsRetVal
-varSetString(var_t *pThis, cstr_t *pCStr)
+varSetString(var_t *pThis, cstr_t *pStr)
{
DEFiRet;
ISOBJ_TYPE_assert(pThis, var);
CHKiRet(varUnsetValues(pThis));
- pThis->varType = VARTYPE_CSTR;
- pThis->val.vpCStr = pCStr;
+ pThis->varType = VARTYPE_STR;
+ pThis->val.pStr = pStr;
finalize_it:
RETiRet;
@@ -130,15 +127,15 @@ finalize_it:
/* set an int64 value */
static rsRetVal
-varSetInt64(var_t *pThis, int64 iVal)
+varSetNumber(var_t *pThis, number_t iVal)
{
DEFiRet;
ISOBJ_TYPE_assert(pThis, var);
CHKiRet(varUnsetValues(pThis));
- pThis->varType = VARTYPE_INT64;
- pThis->val.vInt64 = iVal;
+ pThis->varType = VARTYPE_NUMBER;
+ pThis->val.num = iVal;
finalize_it:
RETiRet;
@@ -187,6 +184,7 @@ ConvForOperation(var_t *pThis, var_t *pOther)
if(pThis->varType == VARTYPE_NONE || pOther->varType == VARTYPE_NONE)
ABORT_FINALIZE(RS_RET_INVALID_VAR);
+#if 0
switch(pThis->varType) {
case VARTYPE_NONE:
ABORT_FINALIZE(RS_RET_INVALID_VAR);
@@ -221,6 +219,7 @@ ConvForOperation(var_t *pThis, var_t *pOther)
ABORT_FINALIZE(RS_RET_NOT_IMPLEMENTED);
break;
}
+#endif
finalize_it:
RETiRet;
@@ -247,7 +246,7 @@ CODESTARTobjQueryInterface(var)
pIf->ConstructFinalize = varConstructFinalize;
pIf->Destruct = varDestruct;
pIf->DebugPrint = varDebugPrint;
- pIf->SetInt64 = varSetInt64;
+ pIf->SetNumber = varSetNumber;
pIf->SetString = varSetString;
pIf->ConvForOperation = ConvForOperation;
finalize_it:
diff --git a/var.h b/var.h
index 0dbc9c64..40b33037 100644
--- a/var.h
+++ b/var.h
@@ -27,26 +27,21 @@
/* data types */
typedef enum {
VARTYPE_NONE = 0, /* currently no value set */
- VARTYPE_PSZ = 1,
- VARTYPE_SHORT = 2,
- VARTYPE_INT = 3,
- VARTYPE_LONG = 4,
- VARTYPE_INT64 = 5,
- VARTYPE_CSTR = 6,
- VARTYPE_SYSLOGTIME = 7
+ VARTYPE_STR = 1,
+ VARTYPE_NUMBER = 2,
+ VARTYPE_SYSLOGTIME = 3
} varType_t;
+typedef int64 number_t; /* type to use for numbers */
+
/* the var object */
typedef struct var_s {
BEGINobjInstance; /* Data to implement generic object - MUST be the first data element! */
cstr_t *pcsName;
varType_t varType;
union {
- short vShort;
- int vInt;
- long vLong;
- int64 vInt64;
- cstr_t *vpCStr; /* used for both rsCStr and psz */
+ number_t num;
+ cstr_t *pStr;
syslogTime_t vSyslogTime;
} val;
@@ -59,7 +54,7 @@ BEGINinterface(var) /* name must also be changed in ENDinterface macro! */
rsRetVal (*Construct)(var_t **ppThis);
rsRetVal (*ConstructFinalize)(var_t __attribute__((unused)) *pThis);
rsRetVal (*Destruct)(var_t **ppThis);
- rsRetVal (*SetInt64)(var_t *pThis, int64 iVal);
+ rsRetVal (*SetNumber)(var_t *pThis, number_t iVal);
rsRetVal (*SetString)(var_t *pThis, cstr_t *pCStr);
rsRetVal (*ConvForOperation)(var_t *pThis, var_t *pOther);
ENDinterface(var)