diff options
-rw-r--r-- | README.md | 2 | ||||
-rwxr-xr-x | build | 2 | ||||
-rw-r--r-- | easy-tg.c | 17 |
3 files changed, 1 insertions, 20 deletions
@@ -10,8 +10,6 @@ Easy-to-use helpers for TDLib JSON. * json-c -* pthread (if you compile with `TG_ENABLE_PTHREAD`) - ## Functions * Automatically handles authorization state changes. @@ -1,5 +1,5 @@ #!/bin/sh set -ex -cc -o easy-td.o -std=c99 -I. -DTG_ENABLE_PTHREAD -DTG_DEBUG -fsanitize=address -rdynamic -O0 -g3 -c easy-tg.c +cc -o easy-td.o -std=c99 -I. -DTG_DEBUG -fsanitize=address -rdynamic -O0 -g3 -c easy-tg.c cc -o example.o -std=c99 -I. -DAPI_ID=114514 -DAPI_HASH="\"hhhhhAAAAA\"" -fsanitize=address -rdynamic -O0 -g3 -c example.c cc -o example -std=c99 -lpthread -ltdjson -ljson-c -fsanitize=address easy-td.o example.o @@ -18,11 +18,6 @@ const void *tg_reg4 = NULL; const void *tg_reg5 = NULL; const void *tg_reg6 = NULL; -#ifdef TG_ENABLE_PTHREAD -#include <pthread.h> -static pthread_mutex_t mutex_close = PTHREAD_MUTEX_INITIALIZER; -#endif - json_object *tg_mkreq(const char *extra, const char *type, const char *args_key, json_object *args) { json_object *root = json_object_new_object(); @@ -233,18 +228,12 @@ cleanup: int tg_destroy() { -#ifdef TG_ENABLE_PTHREAD - pthread_mutex_lock(&mutex_close); -#endif if(td == NULL) { return 0; } td_json_client_destroy(td); td = NULL; -#ifdef TG_ENABLE_PTHREAD - pthread_mutex_unlock(&mutex_close); -#endif return 0; } @@ -287,14 +276,8 @@ cleanup: int tg_close() { -#ifdef TG_ENABLE_PTHREAD - pthread_mutex_lock(&mutex_close); -#endif if(td == NULL) return 0; /* Using json object seems to be leaking */ tg_send_raw(false, "{ \"@type\": \"close\" }"); -#ifdef TG_ENABLE_PTHREAD - pthread_mutex_unlock(&mutex_close); -#endif return 0; } |