From d95494643624031193eb318e39cc38bf05dcb85e Mon Sep 17 00:00:00 2001 From: Xiao Pan Date: Tue, 28 May 2024 16:23:04 -0700 Subject: refactor: dynotify: less code --- dynotify.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/dynotify.c b/dynotify.c index da3a963..db1868c 100644 --- a/dynotify.c +++ b/dynotify.c @@ -96,11 +96,8 @@ int main (void) // manpage assign 0 to struct, it seems because C11 when cast 0 to void* is same as NULL? see: // https://www.geeksforgeeks.org/null-pointer-in-c/ struct memory chunk = {0}; - char id_str[DYROOM_ID_LEN]; - // or itoa() - sprintf(id_str, "%d", room[i].id); - char url[29+DYROOM_ID_LEN]="https://www.douyu.com/betard/"; - strcat(url,id_str); + char url[29+DYROOM_ID_LEN]; + sprintf(url, "https://www.douyu.com/betard/%d", room[i].id); curl_easy_setopt(curl, CURLOPT_URL, url); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, cb); -- cgit v1.2.3-70-g09d2