diff options
author | Jan200101 <sentrycraft123@gmail.com> | 2020-12-16 16:35:10 +0100 |
---|---|---|
committer | Jan200101 <sentrycraft123@gmail.com> | 2020-12-16 16:35:10 +0100 |
commit | 1ca0317a351f3075b2ea0b9bb5e59ccb4bcb960b (patch) | |
tree | 4555aeb903071e2a12f66eff46fea403b716257d /src/lutris.c | |
parent | 7cfe6b1e6132e608fcc034bf97611e4b1eb57613 (diff) | |
download | polecat-1ca0317a351f3075b2ea0b9bb5e59ccb4bcb960b.tar.gz polecat-1ca0317a351f3075b2ea0b9bb5e59ccb4bcb960b.zip |
add more warning flags, correct syntax, add UNUSED macro, […]
- added -Wall -Wextra -pedantic to the compile options
- various syntax has been corrected:
- static is used before const
- correct integer types are used in for loops
- empty newlines are added
- every command has an argc and argv but some don't use them so they are marked as potentially unused if compiled on a GNUC compatible compiler
- mark JSONC variables as advanced so they do not show up as generic variables
Diffstat (limited to 'src/lutris.c')
-rw-r--r-- | src/lutris.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/lutris.c b/src/lutris.c index 5e213ff..a5f8ebd 100644 --- a/src/lutris.c +++ b/src/lutris.c @@ -8,7 +8,7 @@ #include "lutris.h" #include "net.h" -const static struct Command lutris_commands[] = { +static const struct Command lutris_commands[] = { #ifdef DEBUG { .name = "install", .func = lutris_install, .description = "install a lutris script" }, #endif @@ -93,7 +93,7 @@ COMMAND(lutris, install) break; default: - unreachable; + UNREACHABLE break; } } @@ -126,7 +126,7 @@ COMMAND(lutris, install) break; default: - unreachable; + UNREACHABLE break; } } @@ -155,7 +155,7 @@ COMMAND(lutris, info) if (installer.filecount) { puts("\nFiles:"); - for (int i = 0; i < installer.filecount; ++i) + for (size_t i = 0; i < installer.filecount; ++i) { printf("\t%s ->%s\n", installer.files[i]->filename, installer.files[i]->url); } @@ -165,13 +165,13 @@ COMMAND(lutris, info) { puts("\nDirectives:"); - for (int i = 0; i < installer.directivecount; ++i) + for (size_t i = 0; i < installer.directivecount; ++i) { printf("\t%s", keywordstr[installer.directives[i]->command]); if (installer.directives[i]->task != NO_TASK) printf(" %s", taskKeywordstr[installer.directives[i]->task]); - for (int j = 0; j < installer.directives[i]->size; ++j) + for (size_t j = 0; j < installer.directives[i]->size; ++j) { printf(" %s", installer.directives[i]->arguments[j]); } @@ -297,7 +297,7 @@ struct script_t lutris_getInstaller(char* installername) installer.filecount = json_object_array_length(files); installer.files = malloc(installer.filecount * sizeof(void*)); - for (int i = 0; i < installer.filecount; ++i) + for (size_t i = 0; i < installer.filecount; ++i) { struct json_object* file = json_object_array_get_idx(files, i); struct lh_entry* entry = json_object_get_object(file)->head; @@ -337,7 +337,7 @@ struct script_t lutris_getInstaller(char* installername) installer.directivecount = json_object_array_length(scriptinstall); installer.directives = malloc(installer.directivecount * sizeof(void*)); - for (int i = 0; i < installer.directivecount; ++i) + for (size_t i = 0; i < installer.directivecount; ++i) { struct json_object* step = json_object_array_get_idx(scriptinstall, i); struct json_object* directive; @@ -457,7 +457,7 @@ struct script_t lutris_getInstaller(char* installername) } installer.directives[i]->arguments = malloc(installer.directives[i]->size * sizeof(char*)); - for (int j = 0; j < installer.directives[i]->size; ++j) + for (size_t j = 0; j < installer.directives[i]->size; ++j) { str = json_object_get_string(options[j+offset]); installer.directives[i]->arguments[j] = malloc(strlen(str) * sizeof(char) +1); @@ -494,9 +494,9 @@ void lutris_freeInstaller(struct script_t* installer) if (installer->directives) { - for (int i = 0; i < installer->directivecount; ++i) + for (size_t i = 0; i < installer->directivecount; ++i) { - for (int j = 0; j < installer->directives[i]->size; ++j) + for (size_t j = 0; j < installer->directives[i]->size; ++j) { free(installer->directives[i]->arguments[j]); } @@ -509,7 +509,7 @@ void lutris_freeInstaller(struct script_t* installer) if (installer->files) { - for (int i = 0; i < installer->filecount; ++i) + for (size_t i = 0; i < installer->filecount; ++i) { free(installer->files[i]->filename); free(installer->files[i]->url); |