1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-28 11:09:54 +00:00

Merge pull request #828 from sogaiu/add-argument-to-janet-panicf-call

Add argument to some janet_panicf calls
This commit is contained in:
Calvin Rose 2021-10-08 08:23:55 -05:00 committed by GitHub
commit 980f55ff69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -137,7 +137,7 @@ static const char *janet_dyncstring(const char *name, const char *dflt) {
const uint8_t *jstr = janet_unwrap_string(x); const uint8_t *jstr = janet_unwrap_string(x);
const char *cstr = (const char *)jstr; const char *cstr = (const char *)jstr;
if (strlen(cstr) != (size_t) janet_string_length(jstr)) { if (strlen(cstr) != (size_t) janet_string_length(jstr)) {
janet_panicf("string %v contains embedded 0s"); janet_panicf("string %v contains embedded 0s", x);
} }
return cstr; return cstr;
} }

View File

@ -1493,7 +1493,9 @@ JanetSignal janet_pcall(
Janet janet_mcall(const char *name, int32_t argc, Janet *argv) { Janet janet_mcall(const char *name, int32_t argc, Janet *argv) {
/* At least 1 argument */ /* At least 1 argument */
if (argc < 1) janet_panicf("method :%s expected at least 1 argument"); if (argc < 1) {
janet_panicf("method :%s expected at least 1 argument", name);
}
/* Find method */ /* Find method */
Janet method = janet_method_lookup(argv[0], name); Janet method = janet_method_lookup(argv[0], name);
if (janet_checktype(method, JANET_NIL)) { if (janet_checktype(method, JANET_NIL)) {