Skip to content

Commit

Permalink
remove direct access to interp->result, initializing potentially unin…
Browse files Browse the repository at this point in the history
…itialized variables
  • Loading branch information
gneumann committed Jun 20, 2008
1 parent 62b2422 commit 43370bf
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 12 deletions.
10 changes: 10 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
2008-06-20 Gustaf Neumann <[email protected]>

* remove direct access to interp->result in
- nscp/nscp.c
- nsd/tclloop.c
- nsd/tclshare.c
- nsproxy/nsproxylib.c
* initializing potentially uninitialized variables in
- nsproxy/nsproxylib.c

2008-05-13 Jeff Rogers <[email protected]>

* configure.in: add -nostartfiles flag to link line when -shared
Expand Down
4 changes: 2 additions & 2 deletions nscp/nscp.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* Tcl commands.
*/

static const char *RCSID = "@(#) $Header: /Users/dossy/Desktop/cvs/aolserver/nscp/nscp.c,v 1.24 2005/08/08 15:32:34 jgdavidson Exp $, compiled: " __DATE__ " " __TIME__;
static const char *RCSID = "@(#) $Header: /Users/dossy/Desktop/cvs/aolserver/nscp/nscp.c,v 1.25 2008/06/20 08:06:32 gneumann Exp $, compiled: " __DATE__ " " __TIME__;

#include "ns.h"

Expand Down Expand Up @@ -363,7 +363,7 @@ EvalThread(void *arg)
Ns_TclLogError(interp);
}
Tcl_AppendResult(interp, "\r\n", NULL);
res = interp->result;
res = Tcl_GetStringResult(interp);
len = strlen(res);
while (len > 0) {
if ((n = send(sessPtr->sock, res, len, 0)) <= 0) goto done;
Expand Down
4 changes: 2 additions & 2 deletions nsd/tclloop.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* monitored and managed by "ns_loop_ctl" command.
*/

static const char *RCSID = "@(#) $Header: /Users/dossy/Desktop/cvs/aolserver/nsd/tclloop.c,v 1.2 2006/06/02 18:51:49 jgdavidson Exp $, compiled: " __DATE__ " " __TIME__;
static const char *RCSID = "@(#) $Header: /Users/dossy/Desktop/cvs/aolserver/nsd/tclloop.c,v 1.3 2008/06/20 08:06:32 gneumann Exp $, compiled: " __DATE__ " " __TIME__;

#include "nsd.h"

Expand Down Expand Up @@ -853,7 +853,7 @@ CheckControl(NsServer *servPtr, Tcl_Interp *interp, LoopData *dataPtr)
}
Ns_MutexLock(&servPtr->tcl.llock);
if (dataPtr->evalPtr == NULL) {
Ns_Log(Error, "loopctl: dropped result: %s", interp->result);
Ns_Log(Error, "loopctl: dropped result: %s", Tcl_GetStringResult(interp));
} else {
str = Tcl_GetStringFromObj(Tcl_GetObjResult(interp), &len);
Tcl_DStringAppend(&dataPtr->evalPtr->result, str, len);
Expand Down
4 changes: 2 additions & 2 deletions nsd/tclshare.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ ShareVar(NsInterp *itPtr, Tcl_Interp *interp, char *varName)
return TCL_ERROR;
}

if (strcmp(interp->result, "1") == 0) {
if (strcmp(Tcl_GetStringResult(interp), "1") == 0) {
/*
* Get existing value in variable being shared.
*/
Expand All @@ -246,7 +246,7 @@ ShareVar(NsInterp *itPtr, Tcl_Interp *interp, char *varName)
char **argv;
int x;
Tcl_InitHashTable(&valuePtr->array, TCL_STRING_KEYS);
if (Tcl_SplitList(interp, interp->result, &argc,
if (Tcl_SplitList(interp, Tcl_GetStringResult(interp), &argc,
(CONST char***)&argv) == TCL_OK) {
for (x = 0; x < argc; x += 2) {
Tcl_HashEntry* newEntry;
Expand Down
11 changes: 5 additions & 6 deletions nsproxy/nsproxylib.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* Library for ns_proxy commands and main loops.
*/

static const char *RCSID = "@(#) $Header: /Users/dossy/Desktop/cvs/aolserver/nsproxy/nsproxylib.c,v 1.6 2007/05/11 22:11:59 shmooved Exp $, compiled: " __DATE__ " " __TIME__;
static const char *RCSID = "@(#) $Header: /Users/dossy/Desktop/cvs/aolserver/nsproxy/nsproxylib.c,v 1.7 2008/06/20 08:06:33 gneumann Exp $, compiled: " __DATE__ " " __TIME__;

#include "nsproxy.h"
#include <poll.h>
Expand Down Expand Up @@ -280,7 +280,7 @@ Ns_ProxyMain(int argc, char **argv, Tcl_AppInitProc *init)
{
Tcl_Interp *interp;
Proc proc;
int result, len, n, max;
int result, len, n, max = 0;
Req *reqPtr;
Tcl_DString in, out;
char *script, *active, *dots;
Expand Down Expand Up @@ -329,7 +329,7 @@ Ns_ProxyMain(int argc, char **argv, Tcl_AppInitProc *init)
interp = Ns_TclCreateInterp();
if (init != NULL) {
if ((*init)(interp) != TCL_OK) {
FatalExit(interp->result);
FatalExit(Tcl_GetStringResult(interp));
}
}

Expand Down Expand Up @@ -1460,7 +1460,7 @@ static void
Export(Tcl_Interp *interp, int code, Tcl_DString *dsPtr)
{
Res hdr;
char *einfo, *ecode, *result;
char *einfo = NULL, *ecode = NULL, *result;
int clen, ilen, rlen;

clen = ilen = rlen = 0;
Expand Down Expand Up @@ -1898,9 +1898,8 @@ FatalExit(char *func)
static char *
ProxyError(Tcl_Interp *interp, Err err)
{
char *msg, *sysmsg, *code;
char *msg = NULL, *sysmsg = NULL, *code = NULL;

sysmsg = NULL;
switch (err) {
case ENone:
code = "ENone";
Expand Down

0 comments on commit 43370bf

Please sign in to comment.