Remove static global variables from armass.c, rtr.c, rtr_http.c, and c.c (#6183)
This commit is contained in:
parent
1be6ed5841
commit
19046106ea
5 changed files with 172 additions and 184 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -20,9 +20,6 @@
|
|||
#define rtr_n core->rtr_n
|
||||
#define rtr_host core->rtr_host
|
||||
|
||||
static RzSocket *s = NULL;
|
||||
static RzThread *rapthread = NULL;
|
||||
|
||||
struct rz_core_rtr_host_t {
|
||||
int proto;
|
||||
char host[512];
|
||||
|
|
@ -45,11 +42,6 @@ typedef struct {
|
|||
|
||||
RZ_API void rz_core_wait(RzCore *core) {
|
||||
rz_cons_singleton()->context->breaked = true;
|
||||
if (rapthread) {
|
||||
RapThread *rt = rz_th_get_user(rapthread);
|
||||
rz_atomic_bool_set(rt->loop, false);
|
||||
rz_th_wait(rapthread);
|
||||
}
|
||||
}
|
||||
|
||||
static void http_logf(RzCore *core, const char *fmt, ...) {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
typedef int (*rz_core_rtr_http_handler_ptr)(RzCore *, RzSocketHTTPRequest *, char *);
|
||||
typedef rz_core_rtr_http_handler_ptr (*rz_core_rtr_http_handler)();
|
||||
static int LOOP_CONTINUE_VALUE = 66;
|
||||
#define LOOP_CONTINUE_VALUE 66
|
||||
|
||||
static int rz_core_rtr_http_cmd(RzCore *core, RzSocketHTTPRequest *rs, char *cmd, char *out, char *headers) {
|
||||
if ((!strcmp(cmd, "Rh*") ||
|
||||
|
|
@ -321,8 +321,6 @@ static int rtr_http_stop(RzCore *u) {
|
|||
(void)rz_socket_connect(sock, "localhost", port, RZ_SOCKET_PROTO_TCP, timeout);
|
||||
rz_socket_free(sock);
|
||||
}
|
||||
rz_socket_free(s);
|
||||
s = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ typedef struct rz_lang_t {
|
|||
RzCoreCmdStrCallback cmd_str;
|
||||
RzCoreCmdfCallback cmdf;
|
||||
RzPath *sys_path; ///< pointer to RzPath, contains path prefix of the system
|
||||
int argc;
|
||||
const char **argv;
|
||||
} RzLang;
|
||||
|
||||
typedef struct rz_lang_plugin_t {
|
||||
|
|
|
|||
|
|
@ -10,12 +10,9 @@
|
|||
#include <rz_lang.h>
|
||||
|
||||
#if __UNIX__
|
||||
static int ac = 0;
|
||||
static const char **av = NULL;
|
||||
|
||||
static bool lang_c_set_argv(RzLang *lang, int argc, const char **argv) {
|
||||
ac = argc;
|
||||
av = argv;
|
||||
lang->argc = argc;
|
||||
lang->argv = argv;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -79,9 +76,9 @@ static int lang_c_file(RzLang *lang, const char *file) {
|
|||
void (*fcn)(RzCore *, int argc, const char **argv);
|
||||
fcn = rz_sys_dlsym(lib, "entry");
|
||||
if (fcn) {
|
||||
fcn(lang->user, ac, av);
|
||||
ac = 0;
|
||||
av = NULL;
|
||||
fcn(lang->user, lang->argc, lang->argv);
|
||||
lang->argc = 0;
|
||||
lang->argv = NULL;
|
||||
} else {
|
||||
eprintf("Cannot find 'entry' symbol in library\n");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue