diff options
author | goodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 1999-11-03 09:23:10 +0000 |
---|---|---|
committer | goodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 1999-11-03 09:23:10 +0000 |
commit | f56ab00e21d175ef62608342f185c5e7977be078 (patch) | |
tree | 1bfc0473e7f51b54d1b276af0efb3ebe41238377 /src/util | |
parent | 52b81606de9ddb65dd608424354a28a856a5daef (diff) |
Changing various things pointed to by compiling with -Wall.
Tom
git-svn-id: http://svn.cactuscode.org/flesh/trunk@1129 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/BinaryTree.c | 18 | ||||
-rw-r--r-- | src/util/CactusTimers.c | 31 | ||||
-rw-r--r-- | src/util/Misc.c | 15 | ||||
-rw-r--r-- | src/util/SKBinTree.c | 6 | ||||
-rw-r--r-- | src/util/StoreHandledData.c | 11 |
5 files changed, 55 insertions, 26 deletions
diff --git a/src/util/BinaryTree.c b/src/util/BinaryTree.c index e57ab153..93464561 100644 --- a/src/util/BinaryTree.c +++ b/src/util/BinaryTree.c @@ -199,6 +199,20 @@ void TreePrintNodes(t_tree *root, int depth, void (*print_node)(void *, int)) } + /*@@ + @routine TreeFindNode + @date Mon Oct 5 11:06:52 1998 + @author Tom Goodale + @desc + Find a node. + @enddesc + @calls + @calledby + @history + + @endhistory + +@@*/ t_tree *TreeFindNode(t_tree *root, void *data, int (*compare)(const void *, const void *)) { int order; @@ -219,6 +233,10 @@ t_tree *TreeFindNode(t_tree *root, void *data, int (*compare)(const void *, cons /* Found it. */ node = root; } + else + { + node = NULL; + } return node; } diff --git a/src/util/CactusTimers.c b/src/util/CactusTimers.c index c9f00c49..b331df7e 100644 --- a/src/util/CactusTimers.c +++ b/src/util/CactusTimers.c @@ -7,7 +7,7 @@ @enddesc @@*/ - +#include <stdio.h> #include <stdlib.h> #include <string.h> @@ -130,6 +130,11 @@ int CCTK_TimerCreate(const char *name) } retval = this_timer; } + else + { + free(timer); + retval = -2; + } } else { @@ -183,11 +188,9 @@ int CCTK_TimerCreateI(void) void CCTK_TimerDestroy(const char *name) { t_Timer *timer; - t_TimerFuncs *funcs; int this_timer; - int handle; - if(this_timer = Util_GetHandle(timers, name, (void **)&timer)) + if((this_timer = Util_GetHandle(timers, name, (void **)&timer)) > -1) { CCTKi_TimerDestroy(this_timer, timer); } @@ -211,7 +214,7 @@ void CCTK_TimerDestroyI(int this_timer) { t_Timer *timer; - if(timer = Util_GetHandledData(timers, this_timer)) + if((timer = Util_GetHandledData(timers, this_timer)) > -1) { CCTKi_TimerDestroy(this_timer, timer); } @@ -272,7 +275,7 @@ void CCTK_TimerStart(const char *name) t_Timer *timer; int this_timer; - if(this_timer = Util_GetHandle(timers, name, (void **)&timer)) + if((this_timer = Util_GetHandle(timers, name, (void **)&timer)) > -1) { CCTKi_TimerStart(this_timer, timer); } @@ -282,7 +285,7 @@ void CCTK_TimerStartI(int this_timer) { t_Timer *timer; - if(timer = Util_GetHandledData(timers, this_timer)) + if((timer = Util_GetHandledData(timers, this_timer)) > -1) { CCTKi_TimerStart(this_timer, timer); } @@ -326,7 +329,7 @@ void CCTK_TimerStop(const char *name) t_Timer *timer; int this_timer; - if(this_timer = Util_GetHandle(timers, name, (void **)&timer)) + if((this_timer = Util_GetHandle(timers, name, (void **)&timer)) > -1) { CCTKi_TimerStop(this_timer, timer); } @@ -336,7 +339,7 @@ void CCTK_TimerStopI(int this_timer) { t_Timer *timer; - if(timer = Util_GetHandledData(timers, this_timer)) + if((timer = Util_GetHandledData(timers, this_timer)) > -1) { CCTKi_TimerStop(this_timer, timer); } @@ -380,7 +383,7 @@ void CCTK_TimerReset(const char *name) t_Timer *timer; int this_timer; - if(this_timer = Util_GetHandle(timers, name, (void **)&timer)) + if((this_timer = Util_GetHandle(timers, name, (void **)&timer)) > -1) { CCTKi_TimerReset(this_timer, timer); } @@ -390,7 +393,7 @@ void CCTK_TimerResetI(int this_timer) { t_Timer *timer; - if(timer = Util_GetHandledData(timers, this_timer)) + if((timer = Util_GetHandledData(timers, this_timer)) > -1) { CCTKi_TimerReset(this_timer, timer); } @@ -434,7 +437,7 @@ void CCTK_TimerGet(const char *name, t_TimerInfo *info) t_Timer *timer; int this_timer; - if(this_timer = Util_GetHandle(timers, name, (void **)&timer)) + if((this_timer = Util_GetHandle(timers, name, (void **)&timer)) > -1) { CCTKi_TimerGet(this_timer, timer, info); } @@ -447,7 +450,7 @@ void CCTK_TimerGetI(int this_timer, t_TimerInfo *info) { t_Timer *timer; - if(timer = Util_GetHandledData(timers, this_timer)) + if((timer = Util_GetHandledData(timers, this_timer)) > -1) { CCTKi_TimerGet(this_timer, timer, info); } @@ -466,9 +469,9 @@ static void CCTKi_TimerGet(int this_timer, t_Timer *timer, t_TimerInfo *info) if(timer) { + total_vars = 0; if(timer->data) { - total_vars = 0; /* Start the timer info for this timer */ for(handle = 0; handle < n_timertypes; handle++) { diff --git a/src/util/Misc.c b/src/util/Misc.c index 8a8d45dc..791fc44f 100644 --- a/src/util/Misc.c +++ b/src/util/Misc.c @@ -28,6 +28,11 @@ #include "cctk_FortranString.h" #include "cctk_WarnLevel.h" +int CCTK_RegexMatch(const char *string, + const char *pattern, + const int nmatch, + regmatch_t *pmatch); + /*@@ @routine Util_SplitString @date Wed Jan 20 10:14:00 1999 @@ -75,7 +80,7 @@ int Util_SplitString(char **before, char **after, const char *string, const char retval = 1; } - if(position && before && after) + if(position && *before && *after) { /* Copy the data */ strncpy(*before, string, (int)(position-string)); @@ -288,9 +293,9 @@ int Util_IntInRange(int inval, const char *range) * 5 - ) or ] */ - if(matched = CCTK_RegexMatch(range, + if((matched = CCTK_RegexMatch(range, "(\\[|\\()?([^]):]*):?([^]):]*)?:?([^]):]*)?(\\]|\\))?", - 6, pmatch)) + 6, pmatch)) != 0) { /* First work out if the range is closed at the lower end. */ if(pmatch[1].rm_so != -1) @@ -414,9 +419,9 @@ int Util_DoubleInRange(double inval, const char *range) * 5 - ) or ] */ - if(matched = CCTK_RegexMatch(range, + if((matched = CCTK_RegexMatch(range, "(\\[|\\()?([^]):]*):?([^]):]*)?:?([^]):]*)?(\\]|\\))?", - 6, pmatch)) + 6, pmatch)) != 0) { /* First work out if the range is closed at the lower end. */ if(pmatch[1].rm_so != -1) diff --git a/src/util/SKBinTree.c b/src/util/SKBinTree.c index f74f4d9d..a01a1058 100644 --- a/src/util/SKBinTree.c +++ b/src/util/SKBinTree.c @@ -12,6 +12,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <ctype.h> #include "SKBinTree.h" @@ -40,7 +41,6 @@ t_sktree *SKTreeStoreData(t_sktree *root, t_sktree *subtree, { int order; t_sktree *newsubtree; - t_sktree *lastnode, *node; if(!subtree) { @@ -96,7 +96,7 @@ t_sktree *SKTreeStoreData(t_sktree *root, t_sktree *subtree, { newsubtree = SKTreeStoreData(subtree, subtree->right, key, data); } - else if(order==0) + else { /* Duplicate key. */ newsubtree = NULL; @@ -273,7 +273,7 @@ t_sktree *SKTreeFindNode(t_sktree *root, const char *key) { node = SKTreeFindNode(root->right, key); } - else if(order==0) + else { /* Found it. */ node = root; diff --git a/src/util/StoreHandledData.c b/src/util/StoreHandledData.c index fecc37d8..c3894e37 100644 --- a/src/util/StoreHandledData.c +++ b/src/util/StoreHandledData.c @@ -98,7 +98,6 @@ int Util_NewHandle(cHandledData **storage, const char *name, void *data) /* Record position of first unused array element. */ (*storage)->first_unused = (*storage)->array_size; - } } else @@ -124,9 +123,13 @@ int Util_NewHandle(cHandledData **storage, const char *name, void *data) /* Change pointer to first unused array element. */ (*storage)->first_unused = FindNextUnused(*storage, (*storage)->first_unused); - }; - }; - }; + } + } + } + else + { + return_code = -1; + } return return_code; |