AmendHub

Download:

jcs

/

subtext

/

amendments

/

318

folder: Use member_size instead of additional defines


jcs made amendment 318 about 1 year ago
--- folder.c Wed Feb 22 22:13:04 2023 +++ folder.c Thu Feb 23 20:47:32 2023 @@ -190,7 +190,7 @@ folder_show(struct session *s, struct folder *folder) { 'q', "QqXx", "Return to main menu" }, { '?', "?", "List menu options" }, }; - char prompt[6 + BOARD_NAME_LENGTH + 8]; + char prompt[6 + member_size(struct folder, name) + 8]; size_t page, pages, nfile_ids; unsigned long *file_ids = NULL; short ret, fpp, fn; @@ -645,7 +645,8 @@ folder_file_view(struct session *s, struct folder *fol { '?', "?", "List these options" }, }; char time[32]; - char prompt[6 + BOARD_NAME_LENGTH + 1 + FOLDER_FILE_FILENAME_LENGTH]; + char prompt[6 + member_size(struct folder, name) + 1 + + member_size(struct folder_file, filename)]; char *path = NULL, *data, c; struct folder_file file; struct username_cache *uploader; --- folder.h Tue Nov 8 13:04:50 2022 +++ folder.h Thu Feb 23 20:48:02 2023 @@ -24,10 +24,8 @@ struct folder { unsigned long id; -#define FOLDER_NAME_LENGTH 32 - char name[FOLDER_NAME_LENGTH]; -#define FOLDER_DESCR_LENGTH 100 - char description[FOLDER_DESCR_LENGTH]; + char name[32]; + char description[100]; bool restricted_posting; bool restricted_viewing; unsigned long last_upload_at;