Rename param

This commit is contained in:
Alex Kotov 2022-01-24 22:17:23 +05:00
parent a4ccd70950
commit ed658c04f0
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
3 changed files with 9 additions and 9 deletions

View File

@ -17,9 +17,9 @@ extern "C" {
#define KERNAUX_NOTNULL_RETURN(cond) do { KERNAUX_ASSERT(cond); if (!(cond)) return; } while (0)
#define KERNAUX_NOTNULL_RETVAL(cond, val) do { KERNAUX_ASSERT(cond); if (!(cond)) return (val); } while (0)
void kernaux_assert_do(const char *file, int line, const char *str);
void kernaux_assert_do(const char *file, int line, const char *msg);
extern void (*kernaux_assert_cb)(const char *file, int line, const char *str);
extern void (*kernaux_assert_cb)(const char *file, int line, const char *msg);
#ifdef __cplusplus
}

View File

@ -1,7 +1,7 @@
#include <kernaux.h>
#include <ruby.h>
static void assert_cb(const char *file, int line, const char *str);
static void assert_cb(const char *file, int line, const char *msg);
static VALUE rb_KernAux_assert_cb(VALUE self);
static VALUE rb_KernAux_assert_cb_EQ(VALUE self, VALUE assert_cb);
@ -26,14 +26,14 @@ void init_assert()
rb_KernAux_assert_do, 3);
}
void assert_cb(const char *const file, const int line, const char *const str)
void assert_cb(const char *const file, const int line, const char *const msg)
{
const VALUE assert_cb_rb = rb_iv_get(rb_KernAux, "@assert_cb");
if (assert_cb_rb == Qnil) return;
const VALUE file_rb = rb_str_new2(file);
const VALUE line_rb = INT2FIX(line);
const VALUE str_rb = rb_str_new2(str);
rb_funcall(assert_cb_rb, rb_intern_call, 3, file_rb, line_rb, str_rb);
const VALUE msg_rb = rb_str_new2(msg);
rb_funcall(assert_cb_rb, rb_intern_call, 3, file_rb, line_rb, msg_rb);
}
VALUE rb_KernAux_assert_cb(const VALUE self)

View File

@ -6,12 +6,12 @@
#include <stddef.h>
void (*kernaux_assert_cb)(const char *file, int line, const char *str) = NULL;
void (*kernaux_assert_cb)(const char *file, int line, const char *msg) = NULL;
void kernaux_assert_do(
const char *const file,
const int line,
const char *const str
const char *const msg
) {
if (kernaux_assert_cb) kernaux_assert_cb(file, line, str);
if (kernaux_assert_cb) kernaux_assert_cb(file, line, msg);
}