diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2012-11-05 17:04:30 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2012-11-05 17:04:30 +0100 |
commit | 704bb9fc2165688ec23f9c7f1fe2776d2c2efa21 (patch) | |
tree | 806e16cf6372e402f2b4b09b41cc808158b979af | |
parent | 6a61b91815b7be2320daa86b4392fda39aeb7be5 (diff) | |
download | rsyslog-704bb9fc2165688ec23f9c7f1fe2776d2c2efa21.tar.gz rsyslog-704bb9fc2165688ec23f9c7f1fe2776d2c2efa21.tar.bz2 rsyslog-704bb9fc2165688ec23f9c7f1fe2776d2c2efa21.zip |
queue: mini-improvement in deserializer (stage work)
-rw-r--r-- | runtime/obj.c | 4 | ||||
-rw-r--r-- | runtime/obj.h | 2 | ||||
-rw-r--r-- | runtime/queue.c | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/runtime/obj.c b/runtime/obj.c index cf4ef50d..b100a522 100644 --- a/runtime/obj.c +++ b/runtime/obj.c @@ -877,7 +877,7 @@ finalize_it: * rgerhards, 2012-11-03 */ rsRetVal -objDeserializeWithMethods(void *ppObj, uchar *pszTypeExpected, strm_t *pStrm, rsRetVal (*fFixup)(obj_t*,void*), void *pUsr, rsRetVal (*objConstruct)(), rsRetVal (*objConstructFinalize)(), rsRetVal (*objSetProperty)()) +objDeserializeWithMethods(void *ppObj, uchar *pszTypeExpected, int lenTypeExpected, strm_t *pStrm, rsRetVal (*fFixup)(obj_t*,void*), void *pUsr, rsRetVal (*objConstruct)(), rsRetVal (*objConstructFinalize)(), rsRetVal (*objSetProperty)()) { DEFiRet; rsRetVal iRetLocal; @@ -904,7 +904,7 @@ objDeserializeWithMethods(void *ppObj, uchar *pszTypeExpected, strm_t *pStrm, rs } } while(iRetLocal != RS_RET_OK); - if(rsCStrSzStrCmp(pstrID, pszTypeExpected, ustrlen(pszTypeExpected))) /* TODO: optimize strlen() - caller shall provide */ + if(rsCStrSzStrCmp(pstrID, pszTypeExpected, lenTypeExpected)) ABORT_FINALIZE(RS_RET_INVALID_OID); CHKiRet(objConstruct(&pObj)); diff --git a/runtime/obj.h b/runtime/obj.h index a93befa3..72f806da 100644 --- a/runtime/obj.h +++ b/runtime/obj.h @@ -118,7 +118,7 @@ ENDinterface(obj) rsRetVal objGetObjInterface(obj_if_t *pIf); PROTOTYPEObjClassInit(obj); PROTOTYPEObjClassExit(obj); -rsRetVal objDeserializeWithMethods(void *ppObj, uchar *pszTypeExpected, strm_t *pStrm, rsRetVal (*fFixup)(obj_t*,void*), void *pUsr, rsRetVal (*objConstruct)(), rsRetVal (*objConstructFinalize)(), rsRetVal (*objSetProperty)()); +rsRetVal objDeserializeWithMethods(void *ppObj, uchar *pszTypeExpected, int lenTypeExpected, strm_t *pStrm, rsRetVal (*fFixup)(obj_t*,void*), void *pUsr, rsRetVal (*objConstruct)(), rsRetVal (*objConstructFinalize)(), rsRetVal (*objSetProperty)()); /* the following definition is only for "friends" */ diff --git a/runtime/queue.c b/runtime/queue.c index 306b88ed..9113ccb5 100644 --- a/runtime/queue.c +++ b/runtime/queue.c @@ -921,7 +921,7 @@ finalize_it: static rsRetVal qDeqDisk(qqueue_t *pThis, msg_t **ppMsg) { DEFiRet; - iRet = objDeserializeWithMethods(ppMsg, (uchar*) "msg", pThis->tVars.disk.pReadDeq, NULL, + iRet = objDeserializeWithMethods(ppMsg, (uchar*) "msg", 3, pThis->tVars.disk.pReadDeq, NULL, NULL, msgConstructForDeserializer, msgConstructFinalizer, MsgSetProperty); RETiRet; } @@ -947,7 +947,7 @@ static rsRetVal qDelDisk(qqueue_t *pThis) int64 offsOut; CHKiRet(strm.GetCurrOffset(pThis->tVars.disk.pReadDel, &offsIn)); - CHKiRet(objDeserializeWithMethods(&pDummyObj, (uchar*) "msg", pThis->tVars.disk.pReadDel, + CHKiRet(objDeserializeWithMethods(&pDummyObj, (uchar*) "msg", 3, pThis->tVars.disk.pReadDel, NULL, NULL, qDelDiskCallbackDummy, qDelDiskCallbackDummy, qDelDiskCallbackDummy)); CHKiRet(strm.GetCurrOffset(pThis->tVars.disk.pReadDel, &offsOut)); |