diff options
author | David Robillard <d@drobilla.net> | 2021-01-02 21:09:27 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2021-01-02 21:09:27 +0100 |
commit | 1c365945ed2ebd5b9f54eb0c8c5c1c6d97cad712 (patch) | |
tree | 4b77266a9ce3e2a11b59bbd2754869c6ee1d172b /examples/file_utils.c | |
parent | a92a194b4fc64e0cfa4a88a59e261f236414d61c (diff) | |
download | pugl-1c365945ed2ebd5b9f54eb0c8c5c1c6d97cad712.tar.gz pugl-1c365945ed2ebd5b9f54eb0c8c5c1c6d97cad712.tar.bz2 pugl-1c365945ed2ebd5b9f54eb0c8c5c1c6d97cad712.zip |
Simplify clang-format configuration and format all code
Diffstat (limited to 'examples/file_utils.c')
-rw-r--r-- | examples/file_utils.c | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/examples/file_utils.c b/examples/file_utils.c index 2b00bdc..8ecbca4 100644 --- a/examples/file_utils.c +++ b/examples/file_utils.c @@ -15,18 +15,18 @@ */ #if !defined(__APPLE__) && !defined(_GNU_SOURCE) -# define _GNU_SOURCE +# define _GNU_SOURCE #endif #include "file_utils.h" #ifdef _WIN32 -# include <io.h> -# include <windows.h> -# define F_OK 0 +# include <io.h> +# include <windows.h> +# define F_OK 0 #else -# include <libgen.h> -# include <unistd.h> +# include <libgen.h> +# include <unistd.h> #endif #include <stdio.h> @@ -36,33 +36,33 @@ char* resourcePath(const char* const programPath, const char* const name) { - char* const binary = strdup(programPath); + char* const binary = strdup(programPath); #ifdef _WIN32 - char programDir[_MAX_DIR]; - _splitpath(binary, programDir, NULL, NULL, NULL); - _splitpath(binary, NULL, programDir + strlen(programDir), NULL, NULL); - programDir[strlen(programDir) - 1] = '\0'; + char programDir[_MAX_DIR]; + _splitpath(binary, programDir, NULL, NULL, NULL); + _splitpath(binary, NULL, programDir + strlen(programDir), NULL, NULL); + programDir[strlen(programDir) - 1] = '\0'; #else - char* const programDir = dirname(binary); + char* const programDir = dirname(binary); #endif - const size_t programDirLen = strlen(programDir); - const size_t nameLen = strlen(name); - const size_t totalLen = programDirLen + nameLen + 4; + const size_t programDirLen = strlen(programDir); + const size_t nameLen = strlen(name); + const size_t totalLen = programDirLen + nameLen + 4; - char* const programRelative = (char*)calloc(totalLen, 1); - snprintf(programRelative, totalLen, "%s/%s", programDir, name); - if (!access(programRelative, F_OK)) { - free(binary); - return programRelative; - } + char* const programRelative = (char*)calloc(totalLen, 1); + snprintf(programRelative, totalLen, "%s/%s", programDir, name); + if (!access(programRelative, F_OK)) { + free(binary); + return programRelative; + } - free(programRelative); - free(binary); + free(programRelative); + free(binary); - const size_t sysPathLen = strlen(PUGL_DATA_DIR) + nameLen + 4; - char* const sysPath = (char*)calloc(sysPathLen, 1); - snprintf(sysPath, sysPathLen, "%s/%s", PUGL_DATA_DIR, name); - return sysPath; + const size_t sysPathLen = strlen(PUGL_DATA_DIR) + nameLen + 4; + char* const sysPath = (char*)calloc(sysPathLen, 1); + snprintf(sysPath, sysPathLen, "%s/%s", PUGL_DATA_DIR, name); + return sysPath; } |