Browse Source

Clean up naming of fn attributes

master
cancel 5 years ago
parent
commit
d4b2ef259e
  1. 4
      bank.h
  2. 17
      base.h
  3. 4
      gbuffer.h
  4. 2
      sim.c
  5. 6
      sysmisc.c
  6. 14
      term_util.c
  7. 4
      term_util.h
  8. 10
      tui_main.c

4
bank.h

@ -62,7 +62,7 @@ typedef struct {
void oevent_list_init(Oevent_list *olist); void oevent_list_init(Oevent_list *olist);
void oevent_list_deinit(Oevent_list *olist); void oevent_list_deinit(Oevent_list *olist);
void oevent_list_clear(Oevent_list *olist); void oevent_list_clear(Oevent_list *olist);
ORCA_FORCE_NO_INLINE ORCA_NOINLINE
void oevent_list_copy(Oevent_list const *src, Oevent_list *dest); void oevent_list_copy(Oevent_list const *src, Oevent_list *dest);
ORCA_FORCE_NO_INLINE ORCA_NOINLINE
Oevent *oevent_list_alloc_item(Oevent_list *olist); Oevent *oevent_list_alloc_item(Oevent_list *olist);

17
base.h

@ -18,17 +18,14 @@
// (gcc / clang) or msvc or other // (gcc / clang) or msvc or other
#if defined(__GNUC__) || defined(__clang__) #if defined(__GNUC__) || defined(__clang__)
#define ORCA_FORCE_INLINE __attribute__((always_inline)) inline #define ORCA_FORCEINLINE __attribute__((always_inline)) inline
#define ORCA_FORCE_STATIC_INLINE __attribute__((always_inline)) static inline #define ORCA_NOINLINE __attribute__((noinline))
#define ORCA_FORCE_NO_INLINE __attribute__((noinline))
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
#define ORCA_FORCE_INLINE __forceinline #define ORCA_FORCEINLINE __forceinline
#define ORCA_FORCE_STATIC_INLINE __forceinline static #define ORCA_NOINLINE __declspec(noinline)
#define ORCA_FORCE_NO_INLINE __declspec(noinline)
#else #else
#define ORCA_FORCE_INLINE inline #define ORCA_FORCEINLINE inline
#define ORCA_FORCE_STATIC_INLINE inline static #define ORCA_NOINLINE
#define ORCA_FORCE_NO_INLINE
#endif #endif
// (gcc / clang) or other // (gcc / clang) or other
@ -79,7 +76,7 @@ typedef ssize_t Isz;
typedef char Glyph; typedef char Glyph;
typedef U8 Mark; typedef U8 Mark;
ORCA_FORCE_STATIC_INLINE Usz orca_round_up_power2(Usz x) { ORCA_FORCEINLINE static Usz orca_round_up_power2(Usz x) {
assert(x <= SIZE_MAX / 2 + 1); assert(x <= SIZE_MAX / 2 + 1);
x -= 1; x -= 1;
x |= (x >> 1); x |= (x >> 1);

4
gbuffer.h

@ -35,13 +35,13 @@ static inline void gbuffer_poke_relative(Glyph *gbuf, Usz height, Usz width,
gbuf[(Usz)y0 * width + (Usz)x0] = g; gbuf[(Usz)y0 * width + (Usz)x0] = g;
} }
ORCA_FORCE_NO_INLINE ORCA_NOINLINE
void gbuffer_copy_subrect(Glyph *src, Glyph *dest, Usz src_grid_h, void gbuffer_copy_subrect(Glyph *src, Glyph *dest, Usz src_grid_h,
Usz src_grid_w, Usz dest_grid_h, Usz dest_grid_w, Usz src_grid_w, Usz dest_grid_h, Usz dest_grid_w,
Usz src_y, Usz src_x, Usz dest_y, Usz dest_x, Usz src_y, Usz src_x, Usz dest_y, Usz dest_x,
Usz height, Usz width); Usz height, Usz width);
ORCA_FORCE_NO_INLINE ORCA_NOINLINE
void gbuffer_fill_subrect(Glyph *gbuf, Usz grid_h, Usz grid_w, Usz y, Usz x, void gbuffer_fill_subrect(Glyph *gbuf, Usz grid_h, Usz grid_w, Usz y, Usz x,
Usz height, Usz width, Glyph fill_char); Usz height, Usz width, Glyph fill_char);

2
sim.c

@ -126,7 +126,7 @@ static void oper_poke_and_stun(Glyph *restrict gbuffer, Mark *restrict mbuffer,
mbuffer[offs] |= Mark_flag_sleep; mbuffer[offs] |= Mark_flag_sleep;
} }
#define OPER_FUNCTION_ATTRIBS ORCA_FORCE_NO_INLINE static void #define OPER_FUNCTION_ATTRIBS ORCA_NOINLINE static void
#define BEGIN_OPERATOR(_oper_name) \ #define BEGIN_OPERATOR(_oper_name) \
OPER_FUNCTION_ATTRIBS oper_behavior_##_oper_name( \ OPER_FUNCTION_ATTRIBS oper_behavior_##_oper_name( \

6
sysmisc.c

@ -5,7 +5,7 @@
#include <errno.h> #include <errno.h>
#include <sys/stat.h> #include <sys/stat.h>
ORCA_FORCE_NO_INLINE ORCA_NOINLINE
Cboard_error cboard_copy(Glyph const *gbuffer, Usz field_height, Cboard_error cboard_copy(Glyph const *gbuffer, Usz field_height,
Usz field_width, Usz rect_y, Usz rect_x, Usz rect_h, Usz field_width, Usz rect_y, Usz rect_x, Usz rect_h,
Usz rect_w) { Usz rect_w) {
@ -28,7 +28,7 @@ Cboard_error cboard_copy(Glyph const *gbuffer, Usz field_height,
return status ? Cboard_error_process_exit_error : Cboard_error_none; return status ? Cboard_error_process_exit_error : Cboard_error_none;
} }
ORCA_FORCE_NO_INLINE ORCA_NOINLINE
Cboard_error cboard_paste(Glyph *gbuffer, Usz height, Usz width, Usz y, Usz x, Cboard_error cboard_paste(Glyph *gbuffer, Usz height, Usz width, Usz y, Usz x,
Usz *out_h, Usz *out_w) { Usz *out_h, Usz *out_w) {
FILE *fp = FILE *fp =
@ -69,7 +69,7 @@ Cboard_error cboard_paste(Glyph *gbuffer, Usz height, Usz width, Usz y, Usz x,
return status ? Cboard_error_process_exit_error : Cboard_error_none; return status ? Cboard_error_process_exit_error : Cboard_error_none;
} }
ORCA_FORCE_NO_INLINE ORCA_NOINLINE
Conf_read_result conf_read_line(FILE *file, char *buf, Usz bufsize, Conf_read_result conf_read_line(FILE *file, char *buf, Usz bufsize,
char **out_left, Usz *out_leftsize, char **out_left, Usz *out_leftsize,
char **out_right, Usz *out_rightsize) { char **out_right, Usz *out_rightsize) {

14
term_util.c

@ -69,8 +69,7 @@ void qnav_deinit() {
while (qnav_stack.count != 0) while (qnav_stack.count != 0)
qnav_stack_pop(); qnav_stack_pop();
} }
static ORCA_FORCE_NO_INLINE void qnav_stack_push(Qblock *qb, int height, static ORCA_NOINLINE void qnav_stack_push(Qblock *qb, int height, int width) {
int width) {
#ifndef NDEBUG #ifndef NDEBUG
for (Usz i = 0; i < qnav_stack.count; ++i) { for (Usz i = 0; i < qnav_stack.count; ++i) {
assert(qnav_stack.blocks[i] != qb); assert(qnav_stack.blocks[i] != qb);
@ -313,7 +312,7 @@ Qmenu *qmenu_create(int id) {
} }
void qmenu_destroy(Qmenu *qm) { qmenu_free(qm); } void qmenu_destroy(Qmenu *qm) { qmenu_free(qm); }
int qmenu_id(Qmenu const *qm) { return qm->id; } int qmenu_id(Qmenu const *qm) { return qm->id; }
static ORCA_FORCE_NO_INLINE void static ORCA_NOINLINE void
qmenu_allocitems(Qmenu *qm, Usz count, Usz *out_idx, ITEM ***out_items, qmenu_allocitems(Qmenu *qm, Usz count, Usz *out_idx, ITEM ***out_items,
struct Qmenu_item_extra **out_extras) { struct Qmenu_item_extra **out_extras) {
Usz old_count = qm->items_count; Usz old_count = qm->items_count;
@ -349,16 +348,15 @@ qmenu_allocitems(Qmenu *qm, Usz count, Usz *out_idx, ITEM ***out_items,
*out_extras = *out_extras =
(struct Qmenu_item_extra *)((char *)items + extras_offset) + old_count; (struct Qmenu_item_extra *)((char *)items + extras_offset) + old_count;
} }
ORCA_FORCE_STATIC_INLINE struct Qmenu_item_extra * ORCA_FORCEINLINE static struct Qmenu_item_extra *
qmenu_item_extras_ptr(Qmenu *qm) { qmenu_item_extras_ptr(Qmenu *qm) {
Usz offset = sizeof(ITEM *) * qm->items_cap; Usz offset = sizeof(ITEM *) * qm->items_cap;
return (struct Qmenu_item_extra *)((char *)qm->ncurses_items + offset); return (struct Qmenu_item_extra *)((char *)qm->ncurses_items + offset);
} }
// Get the curses menu item user pointer out, turn it to an int, and use it as // Get the curses menu item user pointer out, turn it to an int, and use it as
// an index into the 'extras' arrays. // an index into the 'extras' arrays.
ORCA_FORCE_STATIC_INLINE ORCA_FORCEINLINE static struct Qmenu_item_extra *
struct Qmenu_item_extra *qmenu_itemextra(struct Qmenu_item_extra *extras, qmenu_itemextra(struct Qmenu_item_extra *extras, ITEM *item) {
ITEM *item) {
return extras + (int)(intptr_t)(item_userptr(item)); return extras + (int)(intptr_t)(item_userptr(item));
} }
void qmenu_set_title(Qmenu *qm, char const *title) { void qmenu_set_title(Qmenu *qm, char const *title) {
@ -520,7 +518,7 @@ void qmenu_free(Qmenu *qm) {
free(qm); free(qm);
} }
ORCA_FORCE_NO_INLINE ORCA_NOINLINE
static void qmenu_drive_upordown(Qmenu *qm, int req_up_or_down) { static void qmenu_drive_upordown(Qmenu *qm, int req_up_or_down) {
struct Qmenu_item_extra *extras = qmenu_item_extras_ptr(qm); struct Qmenu_item_extra *extras = qmenu_item_extras_ptr(qm);
ITEM *starting = current_item(qm->ncurses_menu); ITEM *starting = current_item(qm->ncurses_menu);

4
term_util.h

@ -43,8 +43,8 @@ typedef enum {
A_reverse = A_REVERSE, A_reverse = A_REVERSE,
} Term_attr; } Term_attr;
static ORCA_FORCE_INLINE ORCA_OK_IF_UNUSED attr_t fg_bg(Color_name fg, static ORCA_FORCEINLINE ORCA_OK_IF_UNUSED attr_t fg_bg(Color_name fg,
Color_name bg) { Color_name bg) {
return COLOR_PAIR(1 + fg * Colors_count + bg); return COLOR_PAIR(1 + fg * Colors_count + bg);
} }

10
tui_main.c

@ -958,7 +958,7 @@ void ged_set_midi_mode(Ged *a, Midi_mode const *midi_mode) {
a->midi_mode = midi_mode; a->midi_mode = midi_mode;
} }
static ORCA_FORCE_NO_INLINE void // static ORCA_NOINLINE void //
send_midi_chan_msg(Oosc_dev *oosc_dev, Midi_mode const *midi_mode, send_midi_chan_msg(Oosc_dev *oosc_dev, Midi_mode const *midi_mode,
int type /*0..15*/, int chan /*0.. 15*/, int type /*0..15*/, int chan /*0.. 15*/,
int byte1 /*0..127*/, int byte2 /*0..127*/) { int byte1 /*0..127*/, int byte2 /*0..127*/) {
@ -996,7 +996,7 @@ send_midi_chan_msg(Oosc_dev *oosc_dev, Midi_mode const *midi_mode,
} }
} }
static ORCA_FORCE_NO_INLINE void // static ORCA_NOINLINE void //
send_midi_note_offs(Oosc_dev *oosc_dev, Midi_mode const *midi_mode, send_midi_note_offs(Oosc_dev *oosc_dev, Midi_mode const *midi_mode,
Susnote const *start, Susnote const *end) { Susnote const *start, Susnote const *end) {
for (; start != end; ++start) { for (; start != end; ++start) {
@ -2512,7 +2512,7 @@ enum {
char const *const prefval_plain = "plain"; char const *const prefval_plain = "plain";
char const *const prefval_fancy = "fancy"; char const *const prefval_fancy = "fancy";
ORCA_FORCE_NO_INLINE ORCA_NOINLINE
bool plainorfancy(char const *val, bool *out) { bool plainorfancy(char const *val, bool *out) {
if (strcmp(val, prefval_plain) == 0) { if (strcmp(val, prefval_plain) == 0) {
*out = false; *out = false;
@ -2525,7 +2525,7 @@ bool plainorfancy(char const *val, bool *out) {
return false; return false;
} }
ORCA_FORCE_NO_INLINE ORCA_NOINLINE
bool conf_read_boolish(char const *val, bool *out) { bool conf_read_boolish(char const *val, bool *out) {
static char const *const trues[] = {"1", "true", "yes"}; static char const *const trues[] = {"1", "true", "yes"};
static char const *const falses[] = {"0", "false", "no"}; static char const *const falses[] = {"0", "false", "no"};
@ -2544,7 +2544,7 @@ bool conf_read_boolish(char const *val, bool *out) {
return false; return false;
} }
ORCA_FORCE_NO_INLINE ORCA_NOINLINE
Prefs_load_error prefs_load_from_conf_file(Prefs *p) { Prefs_load_error prefs_load_from_conf_file(Prefs *p) {
Ezconf_r ez; Ezconf_r ez;
for (ezconf_r_start(&ez); ezconf_r_step(&ez, confopts, Confoptslen);) { for (ezconf_r_start(&ez); ezconf_r_step(&ez, confopts, Confoptslen);) {

Loading…
Cancel
Save