diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2023-10-15 17:17:06 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2023-10-15 17:17:06 +0000 |
commit | 13894c659cc013427ddafa483768472fbcc76623 (patch) | |
tree | c072e14fad53f22cae72a9480c29e78ad12d4074 /buildtools | |
parent | 41cb71ac953638174b82a6fb450470c75c6a9c61 (diff) | |
download | netpbm-mirror-13894c659cc013427ddafa483768472fbcc76623.tar.gz netpbm-mirror-13894c659cc013427ddafa483768472fbcc76623.tar.xz netpbm-mirror-13894c659cc013427ddafa483768472fbcc76623.zip |
whitespace
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4757 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'buildtools')
-rw-r--r-- | buildtools/endiangen.c | 9 | ||||
-rw-r--r-- | buildtools/genfontc.c | 19 | ||||
-rw-r--r-- | buildtools/libopt.c | 104 | ||||
-rw-r--r-- | buildtools/typegen.c | 7 |
4 files changed, 72 insertions, 67 deletions
diff --git a/buildtools/endiangen.c b/buildtools/endiangen.c index 6b88b896..c770747b 100644 --- a/buildtools/endiangen.c +++ b/buildtools/endiangen.c @@ -13,7 +13,7 @@ #ifndef BIG_ENDIAN #define BIG_ENDIAN 4321 #endif - + #ifndef BYTE_ORDER #define BYTE_ORDER LITTLE_ENDIAN #endif @@ -21,7 +21,7 @@ #define BITS_PER_WORD 32 #endif - + Really good code usually is not sensitive to endianness. But fast, not-so-good code often is. The best way for code to determine endianness is for it to do a runtime cast of an integer to an array @@ -38,7 +38,7 @@ enum endianness {ENDIAN_LITTLE, ENDIAN_BIG}; static enum endianness byteOrder(void) { - + enum endianness retval; union { @@ -83,7 +83,7 @@ main(int argc, char **argv) { printf("#endif\n"); printf("\n"); printf("#ifndef BYTE_ORDER\n"); - printf("#define BYTE_ORDER %s\n", + printf("#define BYTE_ORDER %s\n", byteOrder() == ENDIAN_LITTLE ? "LITTLE_ENDIAN" : "BIG_ENDIAN"); printf("#endif\n"); printf("\n"); @@ -94,4 +94,3 @@ main(int argc, char **argv) { - diff --git a/buildtools/genfontc.c b/buildtools/genfontc.c index ce6b8c9c..b087026d 100644 --- a/buildtools/genfontc.c +++ b/buildtools/genfontc.c @@ -10,10 +10,10 @@ struct CmdlineInfo { /* All the information the user supplied in the command line, in a form easy for the program to use. */ - const char * font; - const char * builtin; - const char * header; - const char * varname; + const char * font; + const char * builtin; + const char * header; + const char * varname; unsigned int verbose; }; @@ -108,7 +108,6 @@ computeFont(const char * const fontName, - static void dumpfont(struct font * const fontP, const char * const header, @@ -126,7 +125,7 @@ dumpfont(struct font * const fontP, } if (header != NULL) - printf("#include \"%s\"\n\n", header); + printf("#include \"%s\"\n\n", header); printf("static struct glyph _g[%d] = {\n", ng); @@ -139,13 +138,13 @@ dumpfont(struct font * const fontP, printf(" { %d, %d, %d, %d, %d, \"", glyphP->width, glyphP->height, glyphP->x, glyphP->y, glyphP->xadd); - + for (j = 0; j < glyphP->width * glyphP->height; ++j) { if (glyphP->bmap[j]) printf("\\1"); else printf("\\0"); - } + } --ng; printf("\" }%s\n", ng ? "," : ""); } @@ -164,7 +163,7 @@ dumpfont(struct font * const fontP, printf(" _g + %d", ng++); else printf(" NULL"); - + if (i != 255) printf(","); @@ -186,7 +185,7 @@ main(int argc, const char *argv[]) { pm_proginit(&argc, argv); parseCommandLine(argc, argv, &cmdline); - + computeFont(cmdline.font, cmdline.builtin, &fontP); if (cmdline.verbose) diff --git a/buildtools/libopt.c b/buildtools/libopt.c index f62194e5..c714f416 100644 --- a/buildtools/libopt.c +++ b/buildtools/libopt.c @@ -17,7 +17,7 @@ The "lib" part of the library name, which we call the prefix, may be other than "lib". The list of recognized values is compiled in as the macro SHLIBPREFIXLIST (see below). - + There is no newline or null character or anything after the output. If you specify the option "-runtime", the output includes a -R @@ -78,7 +78,7 @@ have. "lib" is traditionally the only prefix, as in libc or libnetpbm. However, on Windows there is a convention of using different prefixes to distinguish different co-existent versions of - the same library (kind of like a major number in some unices). + the same library (kind of like a major number in some unices). E.g. the value "cyg lib" is appropriate for a Cygwin system. */ #ifndef SHLIBPREFIXLIST @@ -103,7 +103,7 @@ static const char * dllverstr = DLLVERSTR; static const char * dllverstr = ""; #endif -bool const explicit = +bool const explicit = #ifdef EXPLICIT TRUE #else @@ -117,8 +117,9 @@ strfree(const char * const arg) { } + static void -parse_prefixlist(const char * const prefixlist, +parse_prefixlist(const char * const prefixlist, char * parsed_prefixes[MAX_PREFIXES+1], bool * const errorP) { /*---------------------------------------------------------------------------- @@ -140,7 +141,7 @@ parse_prefixlist(const char * const prefixlist, if (prlist == NULL) *errorP = TRUE; else { - if (strlen(prlist) <= 0) + if (strlen(prlist) <= 0) *errorP = TRUE; else { /* NOTE: Mac OS X, at least, does not have strtok_r(). @@ -149,7 +150,7 @@ parse_prefixlist(const char * const prefixlist, char * token; int num_tokens; int i; - + for (i=0; i < MAX_PREFIXES + 1; i++) { parsed_prefixes[i] = NULL; } @@ -158,14 +159,14 @@ parse_prefixlist(const char * const prefixlist, *errorP = FALSE; /* initial value */ while (token != NULL && num_tokens < MAX_PREFIXES && !*errorP) { parsed_prefixes[num_tokens] = strdup (token); - if (parsed_prefixes[num_tokens] == NULL) + if (parsed_prefixes[num_tokens] == NULL) *errorP = TRUE; num_tokens++; token = strtok(NULL, " "); } for (i = num_tokens; i < MAX_PREFIXES + 1 && !*errorP; i++) { parsed_prefixes[i] = strdup(""); - if (parsed_prefixes[i] == NULL) + if (parsed_prefixes[i] == NULL) *errorP = TRUE; } } @@ -183,31 +184,31 @@ parse_prefixlist(const char * const prefixlist, static void -parse_prefix(const char * const filename, +parse_prefix(const char * const filename, bool * const prefix_good_p, unsigned int * const prefix_length_p, bool * const error_p) { /*---------------------------------------------------------------------------- Find the library name prefix (e.g. "lib") in the library filename 'filename'. - + Return the length of the prefix, in characters, as *prefix_length_p. (The prefix always starts at the beginning of the filename). Iff we don't find a valid library name prefix, return *prefix_good_p - == FALSE. + == FALSE. The list of valid prefixes is compiled in as the blank-delimited string which is the value of the SHLIBPREFIXLIST macro. -----------------------------------------------------------------------------*/ char * shlibprefixlist[MAX_PREFIXES+1]; - /* An argv-style array of prefix strings in the first entries, + /* An argv-style array of prefix strings in the first entries, null strings in the later entries. At most MAX_PREFIXES prefixes, so at least one null string. */ char * prefix; /* The prefix that the filename actually uses. e.g. if shlibprefixlist = { "lib", "cyg", "", ... } and the - filename is "path/to/cyg<something>.<extension>", then + filename is "path/to/cyg<something>.<extension>", then prefix = "cyg". String is in the same storage as pointed to by shlibprefixlist (shlibprefixlist[1] in this example). */ @@ -223,7 +224,7 @@ parse_prefix(const char * const filename, if (strcmp(shlibprefixlist[0], "") == 0) { fprintf(stderr, "libopt was compiled with an invalid value " "of the SHLIBPREFIX macro. It seems to have no " - "tokens. SHLIBPREFIX = '%s'", + "tokens. SHLIBPREFIX = '%s'", SHLIBPREFIXLIST); exit(100); } @@ -236,9 +237,9 @@ parse_prefix(const char * const filename, /* stop condition: shlibprefixlist has MAX_PREFIXES+1 entries. * we only ever put tokens in the 0..MAX_PREFIXES-1 positions. * Then, we fill DOWN from the MAX_PREFIXES position with '\0' - * so we insure that the shlibprefixlist array contains at - * least one final '\0' string, but probably many '\0' - * strings (depending on how many tokens there were). + * so we insure that the shlibprefixlist array contains at + * least one final '\0' string, but probably many '\0' + * strings (depending on how many tokens there were). */ prefix_length = strlen(prefix); if (strncmp(filename, prefix, prefix_length) == 0) { @@ -246,8 +247,8 @@ parse_prefix(const char * const filename, /* at this point, prefix is pointing to the correct * entry, and prefix_length has the correct value. * When we bail out of the while loop because of the - * !prefix_good clause, we can then use these - * vars (prefix, prefix_length) + * !prefix_good clause, we can then use these + * vars (prefix, prefix_length) */ } else { prefix = shlibprefixlist[++i]; @@ -255,9 +256,9 @@ parse_prefix(const char * const filename, } *prefix_length_p = prefix_length; *prefix_good_p = prefix_good; - { + { int i; - for (i=0; i < MAX_PREFIXES + 1; i++) + for (i=0; i < MAX_PREFIXES + 1; i++) free (shlibprefixlist[i]); } } @@ -276,7 +277,7 @@ parse_filename(const char * const filename, is just a filename, not a whole pathname. Return it in newly malloc'ed storage pointed to by '*libname_p'. - + E.g. for "libxyz.so", return "xyz". return *valid_library_p == TRUE iff 'filename' validly names a library @@ -290,13 +291,13 @@ parse_filename(const char * const filename, Do not allocate any memory if *error_p == TRUE or *valid_library_p == FALSE. -----------------------------------------------------------------------------*/ - char *lastdot; + char *lastdot; /* Pointer to last period in 'filename'. Null if none */ - + /* We accept any period-delimited suffix as a library type suffix. It's probably .so or .a, but is could be .kalamazoo for all we - care. (HOWEVER, the double-suffixed import lib used on - cygwin (.dll.a) is NOT understood). + care. (HOWEVER, the double-suffixed import lib used on + cygwin (.dll.a) is NOT understood). */ char *p; @@ -321,8 +322,8 @@ parse_filename(const char * const filename, if (!prefix_good) { *valid_library_p = FALSE; } else { - /* Extract everything between <prefix> and "." as - the library name root. + /* Extract everything between <prefix> and "." as + the library name root. */ char * libname; @@ -334,7 +335,7 @@ parse_filename(const char * const filename, if (strlen(dllverstr) > 0) { p = strstr(libname, dllverstr); if (p) { - if (libname + strlen(libname) + if (libname + strlen(libname) - strlen(dllverstr) == p) { *p = '\0'; } @@ -350,17 +351,17 @@ parse_filename(const char * const filename, } } } -} +} static void parse_filepath(const char * const filepath, - const char ** const directory_p, + const char ** const directory_p, const char ** const filename_p, bool * const error_p) { /*---------------------------------------------------------------------------- - Extract the directory and filename components of the filepath + Extract the directory and filename components of the filepath 'filepath' and return them in newly malloc'ed storage pointed to by '*directory_p' and '*filename_p'. @@ -373,7 +374,7 @@ parse_filepath(const char * const filepath, if (lastslash == NULL) { /* There's no directory component; the filename starts at the - beginning of the filepath + beginning of the filepath */ *filename_p = strdup(filepath); if (*filename_p == NULL) @@ -387,8 +388,8 @@ parse_filepath(const char * const filepath, *error_p = FALSE; } } else { - /* Split the string at the slash we just found, into filename and - directory + /* Split the string at the slash we just found, into filename and + directory */ *filename_p = strdup(lastslash+1); if (*filename_p == NULL) @@ -410,7 +411,7 @@ parse_filepath(const char * const filepath, static void -doOptions(const char * const filepath, +doOptions(const char * const filepath, const char * const directory, const char * const libname, bool const runtime, @@ -434,20 +435,20 @@ doOptions(const char * const filepath, } if (runtime && !staticlib && strlen(directory) > 0) { options = malloc(strlen(linkopt) + strlen(directory) + 10); - sprintf(options, "%s -R%s", linkopt, directory); + sprintf(options, "%s -R%s", linkopt, directory); } else options = strdup(linkopt); - + strfree(linkopt); - + *optionsP = options; } static void -processOneLibrary(const char * const filepath, - bool const runtime, +processOneLibrary(const char * const filepath, + bool const runtime, bool const explicit, const char ** const optionsP, bool * const errorP) { @@ -465,28 +466,28 @@ processOneLibrary(const char * const filepath, if (!*errorP) { const char *libname; /* Library name component of 'filename'. e.g. xyz in - libxyz.so + libxyz.so */ - bool valid_library; + bool valid_library; /* Our argument is a valid library filepath that can be - converted to -l/-L notation. + converted to -l/-L notation. */ bool staticlib; /* Our argument appears to name a static library. */ - parse_filename(filename, + parse_filename(filename, &libname, &valid_library, &staticlib, errorP); - + if (!*errorP) { if (valid_library) { - doOptions(filepath, directory, libname, + doOptions(filepath, directory, libname, runtime, explicit, staticlib, optionsP); strfree(libname); } else *optionsP = strdup(filepath); } - strfree(directory); + strfree(directory); strfree(filename); } } @@ -513,10 +514,10 @@ main(int argc, char **argv) { /* Doesn't do anything today */ } else { const char * options; - processOneLibrary(argv[arg], runtime, explicit, + processOneLibrary(argv[arg], runtime, explicit, &options, &error); if (!error) { - if (strlen(outputLine) + strlen(options) + 1 + 1 > + if (strlen(outputLine) + strlen(options) + 1 + 1 > sizeof(outputLine)) error = TRUE; else { @@ -537,3 +538,6 @@ main(int argc, char **argv) { } return retval; } + + + diff --git a/buildtools/typegen.c b/buildtools/typegen.c index 5b32af28..6ca86072 100644 --- a/buildtools/typegen.c +++ b/buildtools/typegen.c @@ -13,8 +13,8 @@ the same compile environment as what will actually get used to build Netpbm, and thus the one where our inttypes.h will be used. - Right now, it simply generates either - + Right now, it simply generates either + typedef int int32_t; or @@ -111,3 +111,6 @@ main(int argc, char **argv) { return 0; } + + + |