refactoring

This commit is contained in:
Devaev Maxim
2019-09-06 02:00:09 +03:00
parent 9a216153dc
commit 2dbaf08eb0
3 changed files with 5 additions and 6 deletions

View File

@@ -58,7 +58,7 @@ regen:
$(PROG): $(SOURCES:.c=.o) $(PROG): $(SOURCES:.c=.o)
$(info -- LINKING $@) $(info -- LD $@)
@ $(CC) $(SOURCES:.c=.o) -o $@ $(LDFLAGS) $(LIBS) @ $(CC) $(SOURCES:.c=.o) -o $@ $(LDFLAGS) $(LIBS)
$(info ===== Build complete =====) $(info ===== Build complete =====)
$(info == CC = $(CC)) $(info == CC = $(CC))

View File

@@ -44,12 +44,12 @@
#endif #endif
struct main_context_t { struct _main_context_t {
struct stream_t *stream; struct stream_t *stream;
struct http_server_t *server; struct http_server_t *server;
}; };
static struct main_context_t *_ctx; static struct _main_context_t *_ctx;
static void _block_thread_signals(void) { static void _block_thread_signals(void) {
sigset_t mask; sigset_t mask;
@@ -123,7 +123,7 @@ int main(int argc, char *argv[]) {
pthread_t stream_loop_tid; pthread_t stream_loop_tid;
pthread_t server_loop_tid; pthread_t server_loop_tid;
struct main_context_t ctx; struct _main_context_t ctx;
ctx.stream = stream; ctx.stream = stream;
ctx.server = server; ctx.server = server;

View File

@@ -264,9 +264,8 @@ int parse_options(int argc, char *argv[], struct device_t *dev, struct encoder_t
int ch; int ch;
int short_index; int short_index;
int opt_index; int opt_index;
char short_opts[1024]; char short_opts[1024] = {0};
memset(short_opts, 1024, 1);
for (short_index = 0, opt_index = 0; _LONG_OPTS[opt_index].name != NULL; ++opt_index) { for (short_index = 0, opt_index = 0; _LONG_OPTS[opt_index].name != NULL; ++opt_index) {
if (isalpha(_LONG_OPTS[opt_index].val)) { if (isalpha(_LONG_OPTS[opt_index].val)) {
short_opts[short_index] = _LONG_OPTS[opt_index].val; short_opts[short_index] = _LONG_OPTS[opt_index].val;