Valgrind + gcc -pedantic fixes
This commit is contained in:
4
Makefile
4
Makefile
@@ -1,4 +1,4 @@
|
|||||||
CFLAGS=--std=c18 -O2 -Wall -Wextra -pedantic
|
CFLAGS=--std=c11 -O2 -Wall -Wextra -pedantic
|
||||||
LDLIBS=-lncurses -lcurl
|
LDLIBS=-lncurses -lcurl
|
||||||
|
|
||||||
.phony: clean
|
.phony: clean
|
||||||
@@ -10,7 +10,7 @@ objects := $(patsubst %.c,%.o,$(srcs))
|
|||||||
ncac: $(objects)
|
ncac: $(objects)
|
||||||
|
|
||||||
tags: $(srcs) $(hdrs)
|
tags: $(srcs) $(hdrs)
|
||||||
ctags -w -t $^
|
ctags -w $^
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f **/*.o ncac
|
rm -f **/*.o ncac
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ void asana_extract_task(cJSON *json, Task *task) {
|
|||||||
|
|
||||||
cJSON *notes = cJSON_GetObjectItemCaseSensitive(json, "notes");
|
cJSON *notes = cJSON_GetObjectItemCaseSensitive(json, "notes");
|
||||||
if (cJSON_IsString(notes)) {
|
if (cJSON_IsString(notes)) {
|
||||||
task->notes = malloc(sizeof(char)*strlen(notes->valuestring));
|
task->notes = malloc(sizeof(char)*(strlen(notes->valuestring)+1));
|
||||||
strcpy(task->notes, notes->valuestring);
|
strcpy(task->notes, notes->valuestring);
|
||||||
} else {
|
} else {
|
||||||
task->notes = NULL;
|
task->notes = NULL;
|
||||||
@@ -139,7 +139,7 @@ void asana_extract_project(cJSON *json, Project *project) {
|
|||||||
void asana_extract_resource(cJSON *json, Resource *resource) {
|
void asana_extract_resource(cJSON *json, Resource *resource) {
|
||||||
cJSON *gid = cJSON_GetObjectItemCaseSensitive(json, "gid");
|
cJSON *gid = cJSON_GetObjectItemCaseSensitive(json, "gid");
|
||||||
if (cJSON_IsString(gid)) {
|
if (cJSON_IsString(gid)) {
|
||||||
resource->gid = malloc(sizeof(char)*strlen(gid->valuestring));
|
resource->gid = malloc(sizeof(char)*(strlen(gid->valuestring)+1));
|
||||||
strcpy(resource->gid, gid->valuestring);
|
strcpy(resource->gid, gid->valuestring);
|
||||||
fprintf(stderr, "Extracted resource ID %s\n", resource->gid);
|
fprintf(stderr, "Extracted resource ID %s\n", resource->gid);
|
||||||
} else {
|
} else {
|
||||||
@@ -148,7 +148,7 @@ void asana_extract_resource(cJSON *json, Resource *resource) {
|
|||||||
|
|
||||||
cJSON *name = cJSON_GetObjectItemCaseSensitive(json, "name");
|
cJSON *name = cJSON_GetObjectItemCaseSensitive(json, "name");
|
||||||
if (cJSON_IsString(name)) {
|
if (cJSON_IsString(name)) {
|
||||||
resource->name = malloc(sizeof(char)*strlen(name->valuestring));
|
resource->name = malloc(sizeof(char)*(strlen(name->valuestring)+1));
|
||||||
strcpy(resource->name, name->valuestring);
|
strcpy(resource->name, name->valuestring);
|
||||||
} else {
|
} else {
|
||||||
resource->name = NULL;
|
resource->name = NULL;
|
||||||
@@ -193,6 +193,7 @@ asana_err user_task_list_gid(char *workspace_gid, char *gid) {
|
|||||||
strcpy(gid, task_list.gid);
|
strcpy(gid, task_list.gid);
|
||||||
ret = ASANA_ERR_OK;
|
ret = ASANA_ERR_OK;
|
||||||
}
|
}
|
||||||
|
asana_free_resource((Resource *)&task_list);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Error fetching user_task_list: %d\n", task_list_resp->status);
|
fprintf(stderr, "Error fetching user_task_list: %d\n", task_list_resp->status);
|
||||||
}
|
}
|
||||||
@@ -301,4 +302,5 @@ size_t asana_resource_size(Resource *resource) {
|
|||||||
|
|
||||||
fprintf(stderr, "asana_resource_size: Unknown resource type %d\n",
|
fprintf(stderr, "asana_resource_size: Unknown resource type %d\n",
|
||||||
resource->type);
|
resource->type);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
4
ncac.c
4
ncac.c
@@ -5,6 +5,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <signal.h>
|
||||||
#include <term.h>
|
#include <term.h>
|
||||||
|
|
||||||
#include "asana/asana.h"
|
#include "asana/asana.h"
|
||||||
@@ -80,7 +81,8 @@ int main(/*int argc, char **argv*/) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void finish(/*int sig*/) {
|
static void finish(int sig) {
|
||||||
|
(void)sig;
|
||||||
endwin();
|
endwin();
|
||||||
asana_cleanup();
|
asana_cleanup();
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ void draw_status_line(ui_state *state) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void draw_text(const char *text, ui_state *state) {
|
void draw_text(const char *text, ui_state *state) {
|
||||||
if (!text || strnlen(text, 1) == 0) return;
|
if (!text || text[0] == '\0') return;
|
||||||
|
|
||||||
mvaddch(state->curs_y, state->curs_x, *text);
|
mvaddch(state->curs_y, state->curs_x, *text);
|
||||||
++text;
|
++text;
|
||||||
|
|||||||
Reference in New Issue
Block a user