Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow passing a NULL msg to Jim_WrongNumArgs #112

Closed
aryler opened this issue Jun 6, 2018 · 4 comments
Closed

Allow passing a NULL msg to Jim_WrongNumArgs #112

aryler opened this issue Jun 6, 2018 · 4 comments

Comments

@aryler
Copy link

aryler commented Jun 6, 2018

Untested!

--- jim.c.orig  Wed Jun  6 16:05:13 2018
+++ jim.c       Wed Jun  6 16:05:27 2018
@@ -11183,7 +11183,7 @@ void Jim_WrongNumArgs(Jim_Interp *interp, int argc, Ji
 
     listObjPtr = Jim_NewListObj(interp, argv, argc);
 
-    if (*msg) {
+    if (msg && *msg) {
         Jim_ListAppendElement(interp, listObjPtr, Jim_NewStringObj(interp, msg, -1));
     }
     Jim_IncrRefCount(listObjPtr);
@msteveb
Copy link
Owner

msteveb commented Jun 7, 2018

Why?

@aryler
Copy link
Author

aryler commented Jun 7, 2018

  • When there's nothing to say.
  • Line up behaviour a bit with Tcl (saves an #ifdef in Tcl/Jim compatible code).
  • NULL is smaller than "", since "" requires a pointer and a '\0' ?

@aryler
Copy link
Author

aryler commented Jun 7, 2018

You can see what I mean here:
http://chiselapp.com/user/stwo/repository/tjpledge/artifact?ln=100-106&name=ea0b14db3caccd06
It would be nice to be able to write that one one line, like normal.

@msteveb
Copy link
Owner

msteveb commented Jun 7, 2018

OK. The consistency argument is convincing. Done.

@msteveb msteveb closed this as completed Jun 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants