Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1b00dd0

Browse files
committed
Improve minor error-handling details in pltcl.
Don't ask Tcl_GetIndexFromObj to store an error message in the interpreterin cases where the next argument isn't necessarily one of the optionswe're asking it to check for. At best that is a waste of time, and atworst it might cause an inappropriate error result to get left behind.Be sure to check for valid syntax (ie, no command arguments) inpltcl_SPI_lastoid.Extracted from a larger and otherwise-unrelated patch.Jim NasbyPatch: <f2134651-14b3-efeb-f274-c69f3c084031@BlueTreble.com>
1 parent34ca090 commit1b00dd0

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

‎src/pl/tcl/pltcl.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2138,7 +2138,7 @@ pltcl_SPI_execute(ClientData cdata, Tcl_Interp *interp,
21382138
i=1;
21392139
while (i<objc)
21402140
{
2141-
if (Tcl_GetIndexFromObj(interp,objv[i],options,"option",
2141+
if (Tcl_GetIndexFromObj(NULL,objv[i],options,NULL,
21422142
TCL_EXACT,&optIndex)!=TCL_OK)
21432143
break;
21442144

@@ -2484,7 +2484,7 @@ pltcl_SPI_execute_plan(ClientData cdata, Tcl_Interp *interp,
24842484
i=1;
24852485
while (i<objc)
24862486
{
2487-
if (Tcl_GetIndexFromObj(interp,objv[i],options,"option",
2487+
if (Tcl_GetIndexFromObj(NULL,objv[i],options,NULL,
24882488
TCL_EXACT,&optIndex)!=TCL_OK)
24892489
break;
24902490

@@ -2667,6 +2667,15 @@ static int
26672667
pltcl_SPI_lastoid(ClientDatacdata,Tcl_Interp*interp,
26682668
intobjc,Tcl_Obj*constobjv[])
26692669
{
2670+
/*
2671+
* Check call syntax
2672+
*/
2673+
if (objc!=1)
2674+
{
2675+
Tcl_WrongNumArgs(interp,1,objv,"");
2676+
returnTCL_ERROR;
2677+
}
2678+
26702679
Tcl_SetObjResult(interp,Tcl_NewWideIntObj(SPI_lastoid));
26712680
returnTCL_OK;
26722681
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp