Remove inline from .c files

It is ignored by compilers and hides unused static functions
This commit is contained in:
Kovid Goyal
2021-08-03 09:11:17 +05:30
parent 815539a933
commit be34af4555
40 changed files with 393 additions and 393 deletions

View File

@@ -14,7 +14,7 @@
#ifdef ISWINDOWS
#include <io.h>
#define STDOUT_FILENO 1
static inline ssize_t ms_write(int fd, const void* buf, size_t count) { return _write(fd, buf, (unsigned int)count); }
static ssize_t ms_write(int fd, const void* buf, size_t count) { return _write(fd, buf, (unsigned int)count); }
#define write ms_write
#else
#include <unistd.h>
@@ -24,7 +24,7 @@ static inline ssize_t ms_write(int fd, const void* buf, size_t count) { return _
#define FIELD(x, which) (((Candidate*)(x))->which)
static inline bool
static bool
ensure_space(GlobalData *global, size_t sz) {
if (global->output_sz < sz + global->output_pos || !global->output) {
size_t before = global->output_sz;
@@ -38,7 +38,7 @@ ensure_space(GlobalData *global, size_t sz) {
return true;
}
static inline void
static void
output_text(GlobalData *global, const text_t *data, size_t sz) {
if (ensure_space(global, sz)) {
memcpy(global->output + global->output_pos, data, sizeof(text_t) * sz);

View File

@@ -59,7 +59,7 @@ free_workspace(void *v) {
return NULL;
}
static inline bool
static bool
has_char(text_t *text, len_t sz, text_t ch) {
for(len_t i = 0; i < sz; i++) {
if(text[i] == ch) return true;
@@ -67,7 +67,7 @@ has_char(text_t *text, len_t sz, text_t ch) {
return false;
}
static inline uint8_t
static uint8_t
level_factor_for(text_t current, text_t last, WorkSpace *w) {
text_t lch = LOWERCASE(last);
if (has_char(w->level1, w->level1_len, lch)) return 90;
@@ -101,7 +101,7 @@ init_workspace(WorkSpace *w, text_t *haystack, len_t haystack_len) {
}
static inline bool
static bool
has_atleast_one_match(WorkSpace *w) {
int p = -1;
bool found;
@@ -118,7 +118,7 @@ has_atleast_one_match(WorkSpace *w) {
#define POSITION(x) w->positions[x][w->address[x]]
static inline bool
static bool
increment_address(WorkSpace *w) {
len_t pos = w->needle_len - 1;
while(true) {
@@ -130,7 +130,7 @@ increment_address(WorkSpace *w) {
return false;
}
static inline bool
static bool
address_is_monotonic(WorkSpace *w) {
// Check if the character positions pointed to by the current address are monotonic
for (len_t i = 1; i < w->needle_len; i++) {
@@ -139,7 +139,7 @@ address_is_monotonic(WorkSpace *w) {
return true;
}
static inline double
static double
calc_score(WorkSpace *w) {
double ans = 0;
len_t distance, pos;

View File

@@ -41,7 +41,7 @@ typedef struct {
static const Segment EMPTY_SEGMENT = { .current_pos = UINT_MAX };
static inline bool
static bool
convert_segment(PyObject *highlight, Segment *dest) {
PyObject *val = NULL;
#define I
@@ -62,7 +62,7 @@ convert_segment(PyObject *highlight, Segment *dest) {
return true;
}
static inline bool
static bool
next_segment(SegmentPointer *s, PyObject *highlights) {
if (s->pos < s->num) {
if (!convert_segment(PyList_GET_ITEM(highlights, s->pos), &s->sg)) return false;
@@ -89,7 +89,7 @@ ensure_space(LineBuffer *b, size_t num) {
return true;
}
static inline bool
static bool
insert_code(PyObject *code, LineBuffer *b) {
unsigned int csz = PyUnicode_GET_LENGTH(code);
if (!ensure_space(b, csz)) return false;
@@ -97,7 +97,7 @@ insert_code(PyObject *code, LineBuffer *b) {
return true;
}
static inline bool
static bool
add_line(Segment *bg_segment, Segment *fg_segment, LineBuffer *b, PyObject *ans) {
bool bg_is_active = bg_segment->current_pos == bg_segment->end_pos, fg_is_active = fg_segment->current_pos == fg_segment->end_pos;
if (bg_is_active) { if(!insert_code(bg_segment->end_code, b)) return false; }