* Initialize more variables during declaration,
authorArt Cancro <ajc@citadel.org>
Sat, 20 Jan 2007 17:22:04 +0000 (17:22 +0000)
committerArt Cancro <ajc@citadel.org>
Sat, 20 Jan 2007 17:22:04 +0000 (17:22 +0000)
  in the hope of suppressing Valgrind warnings

citadel/database_sleepycat.c
citadel/serv_extensions.c
citadel/serv_vcard.c
citadel/user_ops.c

index 6038d5869a8b8184b1571a4523c299492171e571..e29ce5b0883b22f235908bbdbe2f9245082b0ad6 100644 (file)
@@ -554,14 +554,14 @@ int cdb_store(int cdb, void *ckey, int ckeylen, void *cdata, int cdatalen)
 
        DBT dkey, ddata;
        DB_TXN *tid;
-       int ret;
+       int ret = 0;
 
 #ifdef HAVE_ZLIB
        struct CtdlCompressHeader zheader;
        char *compressed_data = NULL;
        int compressing = 0;
-       size_t buffer_len;
-       uLongf destLen;
+       size_t buffer_len = 0;
+       uLongf destLen = 0;
 #endif
 
        memset(&dkey, 0, sizeof(DBT));
index 5c2ce3867e72c72dc1b6bfcd561f9b7812e8eb32..44a1dcceafa01c8c1b0acaca3c889a7d68b11deb 100644 (file)
@@ -170,7 +170,9 @@ void CtdlRegisterProtoHook(void (*handler) (char *), char *cmd, char *desc)
 
 void CtdlUnregisterProtoHook(void (*handler) (char *), char *cmd)
 {
-       struct ProtoFunctionHook *cur, *p, *lastcur;
+       struct ProtoFunctionHook *cur = NULL;
+       struct ProtoFunctionHook *p = NULL;
+       struct ProtoFunctionHook *lastcur = NULL;
 
        for (cur = ProtoHookList; 
             cur != NULL; 
@@ -819,7 +821,7 @@ void CtdlDestroyServiceHook(void)
 
 void PerformSessionHooks(int EventType)
 {
-       struct SessionFunctionHook *fcn;
+       struct SessionFunctionHook *fcn = NULL;
 
        for (fcn = SessionHookTable; fcn != NULL; fcn = fcn->next) {
                if (fcn->eventtype == EventType) {
@@ -830,7 +832,7 @@ void PerformSessionHooks(int EventType)
 
 void PerformUserHooks(struct ctdluser *usbuf, int EventType)
 {
-       struct UserFunctionHook *fcn;
+       struct UserFunctionHook *fcn = NULL;
 
        for (fcn = UserHookTable; fcn != NULL; fcn = fcn->next) {
                if (fcn->eventtype == EventType) {
@@ -841,7 +843,7 @@ void PerformUserHooks(struct ctdluser *usbuf, int EventType)
 
 int PerformMessageHooks(struct CtdlMessage *msg, int EventType)
 {
-       struct MessageFunctionHook *fcn;
+       struct MessageFunctionHook *fcn = NULL;
        int total_retval = 0;
 
        /* Other code may elect to protect this message from server-side
index a4bee1482ab941a0a78f7c21879ea825b87e3004..9f67eea336af7a1cdcd9cc7501699640d49d12c0 100644 (file)
@@ -961,7 +961,7 @@ void vcard_create_room(void)
  * When a user logs in...
  */
 void vcard_session_login_hook(void) {
-       struct vCard *v;
+       struct vCard *v = NULL;
 
        v = vcard_get_user(&CC->user);
        extract_primary_inet_email(CC->cs_inet_email,
index 9637c14c99654cbef94792f0ae467999be023a14..13e8db773c040a51bbc0c0abf675b325bee75a76 100644 (file)
@@ -166,7 +166,7 @@ int GenerateRelationshipIndex(char *IndexBuf,
 void put_visit(struct visit *newvisit)
 {
        char IndexBuf[32];
-       int IndexLen;
+       int IndexLen = 0;
 
        /* Generate an index */
        IndexLen = GenerateRelationshipIndex(IndexBuf,
@@ -462,7 +462,7 @@ void cmd_user(char *cmdbuf)
  */
 void session_startup(void)
 {
-       int i;
+       int i = 0;
 
        lprintf(CTDL_NOTICE, "<%s> logged in\n", CC->curr_user);