Good C practices
This commit is contained in:
parent
8bcdfc0f13
commit
a85c516926
@ -23,11 +23,11 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
struct map* map_init();
|
struct map* map_init(void);
|
||||||
|
|
||||||
struct map* map_init_void();
|
struct map* map_init_void(void);
|
||||||
|
|
||||||
void map_free();
|
void map_free(struct map* map);
|
||||||
|
|
||||||
bool map_put(struct map* map, const char* key, char* value);
|
bool map_put(struct map* map, const char* key, char* value);
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
time_t utils_get_time_millis();
|
time_t utils_get_time_millis(void);
|
||||||
|
|
||||||
void utils_sleep_millis(time_t millis);
|
void utils_sleep_millis(time_t millis);
|
||||||
|
|
||||||
|
10
inc/wofi.h
10
inc/wofi.h
@ -54,15 +54,15 @@ struct wl_list* wofi_read_cache(char* mode);
|
|||||||
|
|
||||||
void wofi_insert_widget(char* mode, char** text, char* search_text, char** actions, size_t action_count);
|
void wofi_insert_widget(char* mode, char** text, char* search_text, char** actions, size_t action_count);
|
||||||
|
|
||||||
bool wofi_allow_images();
|
bool wofi_allow_images(void);
|
||||||
|
|
||||||
bool wofi_allow_markup();
|
bool wofi_allow_markup(void);
|
||||||
|
|
||||||
uint64_t wofi_get_image_size();
|
uint64_t wofi_get_image_size(void);
|
||||||
|
|
||||||
bool wofi_mod_shift();
|
bool wofi_mod_shift(void);
|
||||||
|
|
||||||
bool wofi_mod_control();
|
bool wofi_mod_control(void);
|
||||||
|
|
||||||
void wofi_term_run(const char* cmd);
|
void wofi_term_run(const char* cmd);
|
||||||
#endif
|
#endif
|
||||||
|
@ -95,10 +95,10 @@ void wofi_dmenu_exec(const gchar* cmd) {
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char** wofi_dmenu_get_arg_names() {
|
const char** wofi_dmenu_get_arg_names(void) {
|
||||||
return arg_names;
|
return arg_names;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t wofi_dmenu_get_arg_count() {
|
size_t wofi_dmenu_get_arg_count(void) {
|
||||||
return sizeof(arg_names) / sizeof(char*);
|
return sizeof(arg_names) / sizeof(char*);
|
||||||
}
|
}
|
||||||
|
@ -175,7 +175,7 @@ static void insert_dir(char* app_dir, struct map* cached, struct map* entries) {
|
|||||||
closedir(dir);
|
closedir(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wofi_drun_init() {
|
void wofi_drun_init(void) {
|
||||||
struct map* cached = map_init();
|
struct map* cached = map_init();
|
||||||
struct map* entries = map_init();
|
struct map* entries = map_init();
|
||||||
struct wl_list* cache = wofi_read_cache(MODE);
|
struct wl_list* cache = wofi_read_cache(MODE);
|
||||||
|
@ -121,10 +121,10 @@ void wofi_run_exec(const gchar* cmd) {
|
|||||||
exit(errno);
|
exit(errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char** wofi_run_get_arg_names() {
|
const char** wofi_run_get_arg_names(void) {
|
||||||
return arg_names;
|
return arg_names;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t wofi_run_get_arg_count() {
|
size_t wofi_run_get_arg_count(void) {
|
||||||
return sizeof(arg_names) / sizeof(char*);
|
return sizeof(arg_names) / sizeof(char*);
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ static void print_usage(char** argv) {
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void load_css() {
|
static void load_css(void) {
|
||||||
if(access(stylesheet, R_OK) == 0) {
|
if(access(stylesheet, R_OK) == 0) {
|
||||||
FILE* file = fopen(stylesheet, "r");
|
FILE* file = fopen(stylesheet, "r");
|
||||||
fseek(file, 0, SEEK_END);
|
fseek(file, 0, SEEK_END);
|
||||||
|
@ -25,14 +25,14 @@ struct map {
|
|||||||
struct map* head, *left, *right;
|
struct map* head, *left, *right;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct map* map_init() {
|
struct map* map_init(void) {
|
||||||
struct map* map = calloc(1, sizeof(struct map));
|
struct map* map = calloc(1, sizeof(struct map));
|
||||||
map->head = map;
|
map->head = map;
|
||||||
map->mman = true;
|
map->mman = true;
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct map* map_init_void() {
|
struct map* map_init_void(void) {
|
||||||
struct map* map = map_init();
|
struct map* map = map_init();
|
||||||
map->mman = false;
|
map->mman = false;
|
||||||
return map;
|
return map;
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
#include <utils.h>
|
#include <utils.h>
|
||||||
|
|
||||||
time_t utils_get_time_millis() {
|
time_t utils_get_time_millis(void) {
|
||||||
struct timeval time;
|
struct timeval time;
|
||||||
gettimeofday(&time, NULL);
|
gettimeofday(&time, NULL);
|
||||||
return (time.tv_sec * 1000) + (time.tv_usec / 1000);
|
return (time.tv_sec * 1000) + (time.tv_usec / 1000);
|
||||||
|
10
src/wofi.c
10
src/wofi.c
@ -555,23 +555,23 @@ void wofi_insert_widget(char* mode, char** text, char* search_text, char** actio
|
|||||||
utils_sleep_millis(1);
|
utils_sleep_millis(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wofi_allow_images() {
|
bool wofi_allow_images(void) {
|
||||||
return allow_images;
|
return allow_images;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wofi_allow_markup() {
|
bool wofi_allow_markup(void) {
|
||||||
return allow_markup;
|
return allow_markup;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t wofi_get_image_size() {
|
uint64_t wofi_get_image_size(void) {
|
||||||
return image_size;
|
return image_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wofi_mod_shift() {
|
bool wofi_mod_shift(void) {
|
||||||
return mod_shift;
|
return mod_shift;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wofi_mod_control() {
|
bool wofi_mod_control(void) {
|
||||||
return mod_ctrl;
|
return mod_ctrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user