diff options
author | John Ankarström <john@ankarstrom.se> | 2021-09-18 10:38:09 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2021-09-18 10:38:09 +0200 |
commit | 0292e86cf884a26108a59d81d69cee83b54f4c88 (patch) | |
tree | 3f5b30fe172013802955213503a5827616be6fec /ctl.c | |
parent | ae9b583b9575679f129680a0f56163fdb6590052 (diff) | |
download | cforum-0292e86cf884a26108a59d81d69cee83b54f4c88.tar.gz |
Clean up database code
Diffstat (limited to 'ctl.c')
-rw-r--r-- | ctl.c | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -20,17 +20,17 @@ printdate(int timestamp) } void -showattachment(id) +showatt(id) { - struct attachment *attachment; + struct att *att; - if(!(attachment = getattachment(byid("attachments", id), 1))){ - srverr("Could not retrieve attachment"); + if(!(att = getatt(byid("atts", id)))){ + srverr("Could not retrieve att"); return; } - printf("Content-Type: %s\n\n", attachment->mime); - printf("%.*s", attachment->bytes, attachment->data); + printf("Content-Type: %s\n\n", att->mime); + printf("%.*s", att->bytes, att->data); } void @@ -57,22 +57,22 @@ void showpost(int id) { char *title; - struct attachment *attachment; + struct att *att; struct post *post; struct user *user; sqlite3_stmt *stmt; - if(!(post = getpost(byid("posts", id), 1))){ + if(!(post = getpost(byid("posts", id)))){ srverr("Could not retrieve post"); return; } - if(!(user = getuser(byid("users", post->user), 1))){ + if(!(user = getuser(byid("users", post->user)))){ srverr("Could not retrieve post author"); return; } - stmt = byid("attachments", id); + stmt = byid("atts", id); title = site.name; printf("Content-Type: text/html\n\n"); @@ -85,7 +85,7 @@ showuser(int id) char *title; struct user *user; - if(!(user = getuser(byid("users", id), 1))){ + if(!(user = getuser(byid("users", id)))){ srverr("Could not retrieve user"); return; } |