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

Fix some error condiditions to have the right number of arguments.

This commit is contained in:
Calvin Rose 2021-07-10 14:09:59 -04:00
parent 41a7154aa5
commit 72c1d1c484
2 changed files with 4 additions and 4 deletions

View File

@ -71,7 +71,7 @@ void janet_panicv(Janet message) {
janet_signalv(JANET_SIGNAL_ERROR, message); janet_signalv(JANET_SIGNAL_ERROR, message);
} }
void janet_panicf(const char *format, ...) { void janet_anicf(const char *format, ...) {
va_list args; va_list args;
const uint8_t *ret; const uint8_t *ret;
JanetBuffer buffer; JanetBuffer buffer;
@ -212,7 +212,7 @@ const char *janet_getcstring(const Janet *argv, int32_t n) {
const uint8_t *jstr = janet_getstring(argv, n); const uint8_t *jstr = janet_getstring(argv, n);
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_panic("string contains embedded 0s");
} }
return cstr; return cstr;
} }

View File

@ -881,7 +881,7 @@ void janet_formatbv(JanetBuffer *b, const char *format, va_list args) {
} }
} }
if (nb >= MAX_ITEM) if (nb >= MAX_ITEM)
janet_panicf("format buffer overflow", form); janet_panic("format buffer overflow");
if (nb > 0) if (nb > 0)
janet_buffer_push_bytes(b, (uint8_t *) item, nb); janet_buffer_push_bytes(b, (uint8_t *) item, nb);
} }
@ -1033,7 +1033,7 @@ void janet_buffer_format(
} }
} }
if (nb >= MAX_ITEM) if (nb >= MAX_ITEM)
janet_panicf("format buffer overflow", form); janet_panic("format buffer overflow");
if (nb > 0) if (nb > 0)
janet_buffer_push_bytes(b, (uint8_t *) item, nb); janet_buffer_push_bytes(b, (uint8_t *) item, nb);
} }