Index: endian.c =================================================================== --- endian.c (revision 48946) +++ endian.c (working copy) @@ -31,9 +31,9 @@ unsigned char c[sizeof(unsigned long)]; } b = {1}; -/* give run-time test preference to compile-time endian, tested much - * faster than stashing in a static. - */ + /* give run-time test preference to compile-time endian, tested much + * faster than stashing in a static. + */ #ifdef WORDS_BIGENDIAN if (LIKELY(b.c[sizeof(unsigned long)-1])) return BU_BIG_ENDIAN; Index: escape.c =================================================================== --- escape.c (revision 48946) +++ escape.c (working copy) @@ -29,7 +29,7 @@ expand_expression(const char *expression, struct bu_vls *vp) { const char *ep = expression; - const char *cp; + const char *cp; if (!expression) return 0; @@ -99,8 +99,7 @@ /* copy input buffer if same or overlapping output buffer */ if (input == output || (input < output && input+strlen(input)+1 > output) - || (input > output && output+need+1 > input)) - { + || (input > output && output+need+1 > input)) { incpy = bu_strdup(input); } } Index: test_vls.c =================================================================== --- test_vls.c (revision 48946) +++ test_vls.c (working copy) @@ -45,10 +45,10 @@ va_end(ap); if (BU_STR_EQUAL(buffer, bu_vls_addr(&vls))) { - printf("%24s -> %28s [PASS]\n", fmt, bu_vls_addr(&vls)); + printf("%24s -> %28s [PASS]\n", fmt, bu_vls_addr(&vls)); } else { - printf("%24s -> %28s [FAIL] (should be: %s)\n", fmt, bu_vls_addr(&vls), buffer); - status = 1; + printf("%24s -> %28s [FAIL] (should be: %s)\n", fmt, bu_vls_addr(&vls), buffer); + status = 1; } bu_vls_free(&vls); @@ -122,8 +122,8 @@ printf("%s: testing complete\n", av[0]); if (fails != 0) { - /* as long as fails is < 127 the STATUS will be the number of unexped failures */ - return fails; + /* as long as fails is < 127 the STATUS will be the number of unexped failures */ + return fails; } /* output expected failures to stderr to be used for the Index: rb_free.c =================================================================== --- rb_free.c (revision 48946) +++ rb_free.c (working copy) @@ -27,7 +27,7 @@ void -bu_rb_free(struct bu_rb_tree *tree, void (*free_data) (/* ??? */)) +bu_rb_free(struct bu_rb_tree *tree, void (*free_data)(/* ??? */)) { struct bu_rb_list *rblp; struct bu_rb_node *node; Index: test_sscanf.c =================================================================== --- test_sscanf.c (revision 48946) +++ test_sscanf.c (working copy) @@ -117,26 +117,26 @@ return val_test; \ } \ /* Runs vsscanf and bu_vsscanf, compares their return values and, - * if they match, compares their conversion values. On any mismatch, - * prints log and returns. - */ \ +* if they match, compares their conversion values. On any mismatch, +* prints log and returns. +*/ \ static void \ test_sscanf_##conv_spec(const char *src, const char *fmt, ...) \ -{ \ - va_list ap; \ - int i, ret, bu_ret; \ - val_type *values = NULL; \ - val_type *bu_values = NULL; \ - /* run system routine */ \ - va_start(ap, fmt); \ - ret = vsscanf(src, fmt, ap); \ - va_end(ap); \ + { \ + va_list ap; \ + int i, ret, bu_ret; \ + val_type *values = NULL; \ + val_type *bu_values = NULL; \ + /* run system routine */ \ + va_start(ap, fmt); \ + ret = vsscanf(src, fmt, ap); \ + va_end(ap); \ if (ret > 0) { \ - /* Create value arrays. Return tells us how many values we converted, \ - * which will be less than or (hopefully) equal to the number of \ - * pointers in the va_list. \ - */ \ - values = (val_type*)bu_malloc(ret * sizeof(val_type), "test_sscanf: value array"); \ + /* Create value arrays. Return tells us how many values we converted, \ + * which will be less than or (hopefully) equal to the number of \ + * pointers in the va_list. \ + */ \ + values = (val_type*)bu_malloc(ret * sizeof(val_type), "test_sscanf: value array"); \ bu_values = (val_type*)bu_malloc(ret * sizeof(val_type), "test_sscanf: bu_value array"); \ /* copy vsscanf pointer values to array */ \ va_start(ap, fmt); \ @@ -145,38 +145,38 @@ } \ va_end(ap); \ } \ - /* run bu routine */ \ - va_start(ap, fmt); \ - bu_ret = bu_vsscanf(src, fmt, ap); \ +/* run bu routine */ \ +va_start(ap, fmt); \ +bu_ret = bu_vsscanf(src, fmt, ap); \ +va_end(ap); \ +/* return values equal? */ \ +if (bu_ret != ret) { \ +printf("[FAIL] sscanf returned %d but bu_sscanf returned %d\n", \ + ret, bu_ret); \ + return; \ +} \ +/* conversion values equal? */ \ +if (values != NULL && bu_values != NULL) { \ +/* copy bu_vsscanf pointer values to array */ \ +va_start(ap, fmt); \ + for (i = 0; i < bu_ret; ++i) { \ + bu_values[i] = *va_arg(ap, val_type*); \ + } \ va_end(ap); \ - /* return values equal? */ \ - if (bu_ret != ret) { \ - printf("[FAIL] sscanf returned %d but bu_sscanf returned %d\n", \ - ret, bu_ret); \ - return; \ - } \ - /* conversion values equal? */ \ - if (values != NULL && bu_values != NULL) { \ - /* copy bu_vsscanf pointer values to array */ \ - va_start(ap, fmt); \ - for (i = 0; i < bu_ret; ++i) { \ - bu_values[i] = *va_arg(ap, val_type*); \ + /* compare vsscanf and bu_vsscanf values */ \ + for (i = 0; i < ret; ++i) { \ + if (!equal_##conv_spec(values[i], bu_values[i])) { \ + printf("[FAIL] conversion value mismatch. " \ + "(sscanf) %" #conv_spec "!= %" #conv_spec " (bu_sscanf)\n", \ + values[i], bu_values[i]); \ + break; \ } \ - va_end(ap); \ - /* compare vsscanf and bu_vsscanf values */ \ - for (i = 0; i < ret; ++i) { \ - if (!equal_##conv_spec(values[i], bu_values[i])) { \ - printf("[FAIL] conversion value mismatch. " \ - "(sscanf) %" #conv_spec "!= %" #conv_spec " (bu_sscanf)\n", \ - values[i], bu_values[i]); \ - break; \ - } \ - } \ - bu_free(values, "test_sscanf: value array\n"); \ - values = NULL; \ - bu_free(bu_values, "test_sscanf: bu_value array\n"); \ - bu_values = NULL; \ } \ + bu_free(values, "test_sscanf: value array\n"); \ + values = NULL; \ + bu_free(bu_values, "test_sscanf: bu_value array\n"); \ + bu_values = NULL; \ +} \ } #else #define TEST_VSSCANF(conv_spec, val_type, val_test) /* nop */ @@ -211,10 +211,10 @@ va_start(ap, fmt); for (i = 0; i < ret; ++i) { values[i] = (char*)bu_malloc(STR_SIZE * sizeof(char), - "test_sscanf: value array"); + "test_sscanf: value array"); bu_values[i] = (char*)bu_malloc(STR_SIZE * sizeof(char), - "test_sscanf: bu_value array"); + "test_sscanf: bu_value array"); strcpy(values[i], va_arg(ap, char*)); } @@ -228,7 +228,7 @@ /* return values equal? */ if (bu_ret != ret) { printf("[FAIL] sscanf returned %d but bu_sscanf returned %d\n", - ret, bu_ret); + ret, bu_ret); printf("\tSource was \"%s\"\n", src); printf("\tFormat was \"%s\"\n", fmt); return; @@ -248,8 +248,8 @@ for (i = 0; i < ret; ++i) { if (!BU_STR_EQUAL(values[i], bu_values[i])) { printf("[FAIL] conversion value mismatch. " - "(sscanf) %s != %s (bu_sscanf)\n", - values[i], bu_values[i]); + "(sscanf) %s != %s (bu_sscanf)\n", + values[i], bu_values[i]); printf("\tSource was \"%s\"\n", src); printf("\tFormat was \"%s\"\n", fmt); break; @@ -281,36 +281,36 @@ printf("bu_sscanf: running tests\n"); -/* Possible test cases: - * 1) Simple conversions, signed and unsigned: - * %,d,i,o,u,x,X,a,e,E,f,g,s,c,[...],p,n - * 2) Modified conversions: - * (h|hh|j|l|t|z)[diouxXn], (l|L)[aeEfg] - * 3) Width specifiers: - * [diouxXaeEfgsc[...]p] - * 4) Non-conversions: - * *,% - * 5) Whitespace skip; arbitrary combinations of whitespace characters - * used to separate strings and conversion specifiers. Preservation - * of leading space for %c and %[...] and discarding for all others. - * - */ + /* Possible test cases: + * 1) Simple conversions, signed and unsigned: + * %,d,i,o,u,x,X,a,e,E,f,g,s,c,[...],p,n + * 2) Modified conversions: + * (h|hh|j|l|t|z)[diouxXn], (l|L)[aeEfg] + * 3) Width specifiers: + * [diouxXaeEfgsc[...]p] + * 4) Non-conversions: + * *,% + * 5) Whitespace skip; arbitrary combinations of whitespace characters + * used to separate strings and conversion specifiers. Preservation + * of leading space for %c and %[...] and discarding for all others. + * + */ /* basic tests */ test_sscanf_d("0 +256 -2048", "%d %d %d", - &d_vals[0], &d_vals[1], &d_vals[2]); + &d_vals[0], &d_vals[1], &d_vals[2]); test_sscanf_u("0 256 2048", "%d %d %d", - &u_vals[0], &u_vals[1], &u_vals[2]); + &u_vals[0], &u_vals[1], &u_vals[2]); test_sscanf_c("a b c", "%c %c %c", - &c_vals[0], &c_vals[1], &c_vals[2]); + &c_vals[0], &c_vals[1], &c_vals[2]); test_sscanf_s(" aBc DeF gHi\t", "%s %s %s", - s_vals[0], s_vals[1], s_vals[2]); + s_vals[0], s_vals[1], s_vals[2]); test_sscanf_lf(".0123 .4567 8.91011", "%lf %lf %lf", - &lf_vals[0], &lf_vals[1], &lf_vals[2]); + &lf_vals[0], &lf_vals[1], &lf_vals[2]); printf("bu_sscanf: testing complete\n"); return 0; Index: rb_rotate.c =================================================================== --- rb_rotate.c (revision 48946) +++ rb_rotate.c (working copy) @@ -71,7 +71,7 @@ } -void rb_rot_right (struct bu_rb_node *y, int order) +void rb_rot_right(struct bu_rb_node *y, int order) { struct bu_rb_node *x; /* y's child to pivot up */ struct bu_rb_node *beta; /* x's child in direction of rot. */ Index: dirent.c =================================================================== --- dirent.c (revision 48946) +++ dirent.c (working copy) @@ -42,8 +42,7 @@ while ((dp = readdir(dir)) != NULL) { if (!pattern || (strlen(pattern) == 0) - || (bu_fnmatch(pattern, dp->d_name, 0) == 0)) - { + || (bu_fnmatch(pattern, dp->d_name, 0) == 0)) { filecount++; } } @@ -61,8 +60,7 @@ while ((dp = readdir(dir)) != NULL) { if (!pattern || (strlen(pattern) == 0) - || (bu_fnmatch(pattern, dp->d_name, 0) == 0)) - { + || (bu_fnmatch(pattern, dp->d_name, 0) == 0)) { (*files)[i++] = bu_strdup(dp->d_name); } } Index: avs.c =================================================================== --- avs.c (revision 48946) +++ avs.c (working copy) @@ -111,12 +111,12 @@ avsp->max += AVS_ALLOCATION_INCREMENT; if (avsp->avp) { avsp->avp = (struct bu_attribute_value_pair *)bu_realloc( - avsp->avp, avsp->max * sizeof(struct bu_attribute_value_pair), - "attribute_value_pair.avp[] (add)"); + avsp->avp, avsp->max * sizeof(struct bu_attribute_value_pair), + "attribute_value_pair.avp[] (add)"); } else { avsp->avp = (struct bu_attribute_value_pair *)bu_calloc( - avsp->max, sizeof(struct bu_attribute_value_pair), - "attribute_value_pair.avp[] (add)"); + avsp->max, sizeof(struct bu_attribute_value_pair), + "attribute_value_pair.avp[] (add)"); } } @@ -287,12 +287,12 @@ avsp->max += AVS_ALLOCATION_INCREMENT; if (avsp->avp) { avsp->avp = (struct bu_attribute_value_pair *)bu_realloc( - avsp->avp, avsp->max * sizeof(struct bu_attribute_value_pair), - "attribute_value_pair.avp[] (add)"); + avsp->avp, avsp->max * sizeof(struct bu_attribute_value_pair), + "attribute_value_pair.avp[] (add)"); } else { avsp->avp = (struct bu_attribute_value_pair *)bu_malloc( - avsp->max * sizeof(struct bu_attribute_value_pair), - "attribute_value_pair.avp[] (add)"); + avsp->max * sizeof(struct bu_attribute_value_pair), + "attribute_value_pair.avp[] (add)"); } } Index: crashreport.c =================================================================== --- crashreport.c (revision 48946) +++ crashreport.c (working copy) @@ -144,8 +144,7 @@ len = strlen(buffer); if ((len == 0) - || ((len == 1) && (buffer[0] == '\n'))) - { + || ((len == 1) && (buffer[0] == '\n'))) { continue; } Index: xdr.c =================================================================== --- xdr.c (revision 48946) +++ xdr.c (working copy) @@ -65,9 +65,12 @@ register const unsigned char *p = msgp; register uint32_t u; - u = *p++; u <<= 8; - u |= *p++; u <<= 8; - u |= *p++; u <<= 8; + u = *p++; + u <<= 8; + u |= *p++; + u <<= 8; + u |= *p++; + u <<= 8; return u | *p; } Index: hist.c =================================================================== --- hist.c (revision 48946) +++ hist.c (working copy) @@ -31,8 +31,7 @@ bu_hist_free(struct bu_hist *histp) { if (UNLIKELY((histp==(struct bu_hist *)NULL) || - (histp && (histp->magic == 0 || histp->magic == (unsigned int)-1)))) - { + (histp && (histp->magic == 0 || histp->magic == (unsigned int)-1)))) { return; } Index: pool.c =================================================================== --- pool.c (revision 48946) +++ pool.c (working copy) @@ -32,8 +32,8 @@ #define INITIAL_BANK_CNT 1 /* intial number of banks to create per pool */ #define INITIAL_BANK_ELEM_CNT 100 /* intial number elements per bank */ #define BANK_ELEM_CNT_INCREMENT_MULTIPLIER 2 /* multiple this number by the previous bank element count - * to determine how many elements to create in the next bank - */ +* to determine how many elements to create in the next bank +*/ /* * Description of 'struct mem_pool' type. @@ -353,7 +353,7 @@ } new_bank_elem_cnt = hd->bank_alloc_cnt[pn][hd->banklist_cnt[pn]-1] * - BANK_ELEM_CNT_INCREMENT_MULTIPLIER; + BANK_ELEM_CNT_INCREMENT_MULTIPLIER; /* freelist will always be large enough to hold all the pointers to allocated * elements in all the banks in the current pool. the reason is so than when Index: htond.c =================================================================== --- htond.c (revision 48946) +++ htond.c (working copy) @@ -159,7 +159,7 @@ # else right = (left<<(32-3)) | (right>>3); # endif - left = ((left & 0x007FFFFF)>>3) | signbit | (exp<<20); + left = ((left & 0x007FFFFF)>>3) | signbit | (exp<<20); *out++ = left>>24; *out++ = left>>16; *out++ = left>>8; @@ -221,19 +221,19 @@ /* fix = 1; */ exp += 1023-129+1+ 3-1; left = (left<<1) | - ((right>>(32-1)) & (0x7FFFFFFF>>(31-1))); + ((right>>(32-1)) & (0x7FFFFFFF>>(31-1))); right <<= 1; } else if (left & 0x00200000) { /* fix = 2; */ exp += 1023-129+1+ 3-2; left = (left<<2) | - ((right>>(32-2)) & (0x7FFFFFFF>>(31-2))); + ((right>>(32-2)) & (0x7FFFFFFF>>(31-2))); right <<= 2; } else if (left & 0x00100000) { /* fix = 3; */ exp += 1023-129+1+ 3-3; left = (left<<3) | - ((right>>(32-3)) & (0x7FFFFFFF>>(31-3))); + ((right>>(32-3)) & (0x7FFFFFFF>>(31-3))); right <<= 3; } else { /* Encountered 4 consecutive 0 bits of mantissa, @@ -261,7 +261,7 @@ # else right = (left<<(32-3)) | (right>>3); # endif - left = ((left & 0x007FFFFF)>>3) | signbit | (exp<<20); + left = ((left & 0x007FFFFF)>>3) | signbit | (exp<<20); *out++ = left>>24; *out++ = left>>16; @@ -285,9 +285,9 @@ register int exp; word = (((long)in[0])<<56) | (((long)in[1])<<48) | - (((long)in[2])<<40) | (((long)in[3])<<32) | - (((long)in[4])<<24) | (((long)in[5])<<16) | - (((long)in[6])<<8) | ((long)in[7]); + (((long)in[2])<<40) | (((long)in[3])<<32) | + (((long)in[4])<<24) | (((long)in[5])<<16) | + (((long)in[6])<<8) | ((long)in[7]); in += 8; if (word == 0) @@ -309,7 +309,7 @@ word += 1; #endif word = ((word & 0x00007FFFFFFFFFFFL) << (15-11+1)) | - signbit | (((long)exp)<<(64-12)); + signbit | (((long)exp)<<(64-12)); *out++ = word>>56; *out++ = word>>48; @@ -479,7 +479,7 @@ goto vax_undef; } left = ((left & 0x000FFFFF)<<3) | signbit | (exp<<23) | - (right >> (32-3)); + (right >> (32-3)); right <<= 3; out[1] = left>>24; out[0] = left>>16; @@ -594,9 +594,9 @@ register int exp; word = (((long)in[0])<<56) | (((long)in[1])<<48) | - (((long)in[2])<<40) | (((long)in[3])<<32) | - (((long)in[4])<<24) | (((long)in[5])<<16) | - (((long)in[6])<<8) | ((long)in[7]); + (((long)in[2])<<40) | (((long)in[3])<<32) | + (((long)in[4])<<24) | (((long)in[5])<<16) | + (((long)in[6])<<8) | ((long)in[7]); in += 8; exp = (word>>(64-12)) & 0x7FF; @@ -611,8 +611,8 @@ } exp += 040000 - 1023 + 1; word = ((word & 0x000FFFFFFFFFFFFFL) >> (15-11+1)) | - 0x0000800000000000L | signbit | - (((long)exp)<<(64-16)); + 0x0000800000000000L | signbit | + (((long)exp)<<(64-16)); cray_out: *out++ = word>>56; @@ -650,7 +650,7 @@ } exp += 1024 - 1023 + 1; word = (word & 0x800FFFFFFFFFFFFFLL) | - (((long long)exp)<<52); + (((long long)exp)<<52); convex_out: *((unsigned long long *)out) = word; Index: color.c =================================================================== --- color.c (revision 48946) +++ color.c (working copy) @@ -129,8 +129,7 @@ if ((((hue < 0.0) || (hue > 360.0)) && (!NEAR_ZERO(hue - ACHROMATIC, SMALL_FASTF))) /* hue != ACHROMATIC */ || (sat < 0.0) || (sat > 1.0) || (val < 0.0) || (val > 1.0) - || ((NEAR_ZERO(hue - ACHROMATIC, SMALL_FASTF)) && (sat > 0.0))) /* hue == ACHROMATIC */ - { + || ((NEAR_ZERO(hue - ACHROMATIC, SMALL_FASTF)) && (sat > 0.0))) { /* hue == ACHROMATIC */ bu_log("bu_hsv_to_rgb: Illegal HSV (%g, %g, %g)\n", V3ARGS(hsv)); return 0; @@ -149,12 +148,24 @@ q = val * (1.0 - (sat * hue_frac)); t = val * (1.0 - (sat * (1.0 - hue_frac))); switch (hue_int) { - case 0: VSET(float_rgb, val, t, p); break; - case 1: VSET(float_rgb, q, val, p); break; - case 2: VSET(float_rgb, p, val, t); break; - case 3: VSET(float_rgb, p, q, val); break; - case 4: VSET(float_rgb, t, p, val); break; - case 5: VSET(float_rgb, val, p, q); break; + case 0: + VSET(float_rgb, val, t, p); + break; + case 1: + VSET(float_rgb, q, val, p); + break; + case 2: + VSET(float_rgb, p, val, t); + break; + case 3: + VSET(float_rgb, p, q, val); + break; + case 4: + VSET(float_rgb, t, p, val); + break; + case 5: + VSET(float_rgb, val, p, q); + break; default: bu_log("%s:%d: This shouldn't happen\n", __FILE__, __LINE__); Index: rb_delete.c =================================================================== --- rb_delete.c (revision 48946) +++ rb_delete.c (working copy) @@ -51,8 +51,7 @@ RB_CKORDER(tree, order); while ((node != rb_root(tree, order)) - && (rb_get_color(node, order) == RB_BLK)) - { + && (rb_get_color(node, order) == RB_BLK)) { parent = rb_parent(node, order); if (node == rb_left_child(parent, order)) direction = RB_LEFT; @@ -67,8 +66,7 @@ w = rb_other_child(parent, order, direction); } if ((rb_get_color(rb_child(w, order, direction), order) == RB_BLK) - && (rb_get_color(rb_other_child(w, order, direction), order) == RB_BLK)) - { + && (rb_get_color(rb_other_child(w, order, direction), order) == RB_BLK)) { rb_set_color(w, order, RB_RED); node = parent; } else { @@ -172,7 +170,7 @@ package = (rb_current(tree)->rbn_package)[order]; node = (struct bu_rb_node **) - bu_malloc(nm_orders * sizeof(struct bu_rb_node *), "node list"); + bu_malloc(nm_orders * sizeof(struct bu_rb_node *), "node list"); for (order = 0; order < nm_orders; ++order) node[order] = (package->rbp_node)[order]; Index: rb_create.c =================================================================== --- rb_create.c (revision 48946) +++ rb_create.c (working copy) @@ -37,32 +37,32 @@ */ tree = (struct bu_rb_tree *) bu_malloc(sizeof(struct bu_rb_tree), "red-black tree"); tree->rbt_root = (struct bu_rb_node **) - bu_malloc(nm_orders * sizeof(struct bu_rb_node), - "red-black roots"); + bu_malloc(nm_orders * sizeof(struct bu_rb_node), + "red-black roots"); tree->rbt_unique = (char *) - bu_malloc((size_t) ceil((double) (nm_orders / 8.0)), - "red-black uniqueness flags"); + bu_malloc((size_t) ceil((double)(nm_orders / 8.0)), + "red-black uniqueness flags"); rb_null(tree) = (struct bu_rb_node *) - bu_malloc(sizeof(struct bu_rb_node), - "red-black empty node"); + bu_malloc(sizeof(struct bu_rb_node), + "red-black empty node"); rb_null(tree)->rbn_parent = (struct bu_rb_node **) - bu_malloc(nm_orders * sizeof(struct bu_rb_node *), - "red-black parents"); + bu_malloc(nm_orders * sizeof(struct bu_rb_node *), + "red-black parents"); rb_null(tree)->rbn_left = (struct bu_rb_node **) - bu_malloc(nm_orders * sizeof(struct bu_rb_node *), - "red-black left children"); + bu_malloc(nm_orders * sizeof(struct bu_rb_node *), + "red-black left children"); rb_null(tree)->rbn_right = (struct bu_rb_node **) - bu_malloc(nm_orders * sizeof(struct bu_rb_node *), - "red-black right children"); + bu_malloc(nm_orders * sizeof(struct bu_rb_node *), + "red-black right children"); rb_null(tree)->rbn_color = (char *) - bu_malloc((size_t) ceil((double) (nm_orders / 8.0)), - "red-black colors"); + bu_malloc((size_t) ceil((double)(nm_orders / 8.0)), + "red-black colors"); rb_null(tree)->rbn_size = (int *) - bu_malloc(nm_orders * sizeof(int), - "red-black subtree sizes"); + bu_malloc(nm_orders * sizeof(int), + "red-black subtree sizes"); rb_null(tree)->rbn_package = (struct bu_rb_package **) - bu_malloc(nm_orders * sizeof(struct bu_rb_package *), - "red-black packages"); + bu_malloc(nm_orders * sizeof(struct bu_rb_package *), + "red-black packages"); /* * Fill in the tree */ @@ -98,12 +98,12 @@ struct bu_rb_tree * -bu_rb_create1(char *description, int (*order_func) (/* ??? */)) +bu_rb_create1(char *description, int (*order_func)(/* ??? */)) { int (**ofp)(); ofp = (int (**)()) - bu_malloc(sizeof(int (*)()), "red-black function table"); + bu_malloc(sizeof(int (*)()), "red-black function table"); *ofp = order_func; return bu_rb_create(description, 1, ofp); } Index: simd.c =================================================================== --- simd.c (revision 48946) +++ simd.c (working copy) @@ -32,17 +32,17 @@ int b=0; __asm__ volatile("cpuid":"=b"(b),"=c"(c),"=d"(d):"a"(0x1)); # endif - if(c & 0x100000) + if (c & 0x100000) return BU_SIMD_SSE4_2; - if(c & 0x080000) + if (c & 0x080000) return BU_SIMD_SSE4_1; - if(c & 0x1) + if (c & 0x1) return BU_SIMD_SSE3; - if(d & 0x1<<26) + if (d & 0x1<<26) return BU_SIMD_SSE2; - if(d & 0x1<<25) + if (d & 0x1<<25) return BU_SIMD_SSE; - if(d & 0x1<<24) + if (d & 0x1<<24) return BU_SIMD_MMX; #endif return BU_SIMD_NONE; @@ -53,7 +53,7 @@ { int l; - if(level == 4) + if (level == 4) return 0; l = bu_simd_level(); Index: realpath.c =================================================================== --- realpath.c (revision 48946) +++ realpath.c (working copy) @@ -33,7 +33,7 @@ char *dirpath; if (!resolved_path) resolved_path = (char *) bu_calloc(MAXPATHLEN, sizeof(char), - "resolved_path alloc"); + "resolved_path alloc"); #ifdef HAVE_REALPATH dirpath = realpath(path, resolved_path); if (!dirpath) { Index: getopt.c =================================================================== --- getopt.c (revision 48946) +++ getopt.c (working copy) @@ -49,8 +49,7 @@ /* update scanning pointer */ if (bu_optind >= nargc || *(place = nargv[bu_optind]) != '-' - || !*++place) - { + || !*++place) { place = EMSG; return -1; } Index: malloc.c =================================================================== --- malloc.c (revision 48946) +++ malloc.c (working copy) @@ -81,8 +81,7 @@ if (LIKELY(bu_memdebug != NULL)) { mp = &bu_memdebug[bu_memdebug_len-1]; if (bu_memdebug_lowat > bu_memdebug - && bu_memdebug_lowat < mp) - { + && bu_memdebug_lowat < mp) { mp = bu_memdebug_lowat; } else { bu_memdebug_lowat = mp; @@ -114,7 +113,7 @@ if (bu_memdebug_len <= 0) { bu_memdebug_len = 5120-2; bu_memdebug = (struct memdebug *)calloc( - bu_memdebug_len, sizeof(struct memdebug)); + bu_memdebug_len, sizeof(struct memdebug)); if (bu_memdebug == (struct memdebug *)0) bu_bomb("memdebug_add() malloc failure\n"); } else { @@ -407,7 +406,7 @@ struct memqdebug *mqp = ((struct memqdebug *)ptr)-1; siz = (siz + 2*sizeof(struct memqdebug) - 1) - &(~(sizeof(struct memqdebug)-1)); + &(~(sizeof(struct memqdebug)-1)); if (UNLIKELY(!BU_LIST_MAGIC_EQUAL(&(mqp->q), MDB_MAGIC))) { fprintf(stderr, "ERROR bu_realloc(%p, %s) pointer bad, " Index: rb_order_stats.c =================================================================== --- rb_order_stats.c (revision 48946) +++ rb_order_stats.c (working copy) @@ -80,7 +80,7 @@ tree, order, k, rb_root(tree, order)); rb_current(tree) = node - = _rb_select(rb_root(tree, order), order, k); + = _rb_select(rb_root(tree, order), order, k); return rb_data(node, order); } Index: getcwd.c =================================================================== --- getcwd.c (revision 48946) +++ getcwd.c (working copy) @@ -57,14 +57,12 @@ cwd = getcwd(cbuf, MAXPATHLEN); if (cwd && strlen(cwd) > 0 - && bu_file_exists(cwd, NULL)) - { + && bu_file_exists(cwd, NULL)) { #ifdef HAVE_REALPATH rwd = realpath(cbuf, rbuf); if (rwd && strlen(rwd) > 0 - && bu_file_exists(rwd, NULL)) - { + && bu_file_exists(rwd, NULL)) { BU_ASSERT(sz > strlen(rwd)+1); bu_strlcpy(buf, rwd, strlen(rwd)+1); return buf; @@ -84,14 +82,12 @@ pwd = getenv("PWD"); if (pwd && strlen(pwd) > 0 - && bu_file_exists(pwd, NULL)) - { + && bu_file_exists(pwd, NULL)) { #ifdef HAVE_REALPATH rwd = realpath(pwd, rbuf); if (rwd && strlen(rwd) > 0 - && bu_file_exists(rwd, NULL)) - { + && bu_file_exists(rwd, NULL)) { BU_ASSERT(sz > strlen(rwd)+1); bu_strlcpy(buf, rwd, strlen(rwd)+1); return buf; Index: rb_walk.c =================================================================== --- rb_walk.c (revision 48946) +++ rb_walk.c (working copy) @@ -35,7 +35,7 @@ * Perform a preorder traversal of a red-black tree */ HIDDEN void -prewalknodes(struct bu_rb_node *root, int order, void (*visit) (/* ??? */), int depth) +prewalknodes(struct bu_rb_node *root, int order, void (*visit)(/* ??? */), int depth) { BU_CKMAG(root, BU_RB_NODE_MAGIC, "red-black node"); RB_CKORDER(root->rbn_tree, order); @@ -43,8 +43,8 @@ if (root == rb_null(root->rbn_tree)) return; visit(root, depth); - prewalknodes (rb_left_child(root, order), order, visit, depth + 1); - prewalknodes (rb_right_child(root, order), order, visit, depth + 1); + prewalknodes(rb_left_child(root, order), order, visit, depth + 1); + prewalknodes(rb_right_child(root, order), order, visit, depth + 1); } @@ -54,16 +54,16 @@ * Perform an inorder traversal of a red-black tree */ HIDDEN void -inwalknodes(struct bu_rb_node *root, int order, void (*visit) (/* ??? */), int depth) +inwalknodes(struct bu_rb_node *root, int order, void (*visit)(/* ??? */), int depth) { BU_CKMAG(root, BU_RB_NODE_MAGIC, "red-black node"); RB_CKORDER(root->rbn_tree, order); if (root == rb_null(root->rbn_tree)) return; - inwalknodes (rb_left_child(root, order), order, visit, depth + 1); + inwalknodes(rb_left_child(root, order), order, visit, depth + 1); visit(root, depth); - inwalknodes (rb_right_child(root, order), order, visit, depth + 1); + inwalknodes(rb_right_child(root, order), order, visit, depth + 1); } @@ -73,15 +73,15 @@ * Perform a postorder traversal of a red-black tree */ HIDDEN void -postwalknodes(struct bu_rb_node *root, int order, void (*visit) (/* ??? */), int depth) +postwalknodes(struct bu_rb_node *root, int order, void (*visit)(/* ??? */), int depth) { BU_CKMAG(root, BU_RB_NODE_MAGIC, "red-black node"); RB_CKORDER(root->rbn_tree, order); if (root == rb_null(root->rbn_tree)) return; - postwalknodes (rb_left_child(root, order), order, visit, depth + 1); - postwalknodes (rb_right_child(root, order), order, visit, depth + 1); + postwalknodes(rb_left_child(root, order), order, visit, depth + 1); + postwalknodes(rb_right_child(root, order), order, visit, depth + 1); visit(root, depth); } @@ -92,7 +92,7 @@ * Perform a preorder traversal of a red-black tree */ HIDDEN void -prewalkdata(struct bu_rb_node *root, int order, void (*visit) (/* ??? */), int depth) +prewalkdata(struct bu_rb_node *root, int order, void (*visit)(/* ??? */), int depth) { BU_CKMAG(root, BU_RB_NODE_MAGIC, "red-black node"); RB_CKORDER(root->rbn_tree, order); @@ -100,8 +100,8 @@ if (root == rb_null(root->rbn_tree)) return; visit(rb_data(root, order), depth); - prewalkdata (rb_left_child(root, order), order, visit, depth + 1); - prewalkdata (rb_right_child(root, order), order, visit, depth + 1); + prewalkdata(rb_left_child(root, order), order, visit, depth + 1); + prewalkdata(rb_right_child(root, order), order, visit, depth + 1); } @@ -111,16 +111,16 @@ * Perform an inorder traversal of a red-black tree */ HIDDEN void -inwalkdata(struct bu_rb_node *root, int order, void (*visit) (/* ??? */), int depth) +inwalkdata(struct bu_rb_node *root, int order, void (*visit)(/* ??? */), int depth) { BU_CKMAG(root, BU_RB_NODE_MAGIC, "red-black node"); RB_CKORDER(root->rbn_tree, order); if (root == rb_null(root->rbn_tree)) return; - inwalkdata (rb_left_child(root, order), order, visit, depth + 1); + inwalkdata(rb_left_child(root, order), order, visit, depth + 1); visit(rb_data(root, order), depth); - inwalkdata (rb_right_child(root, order), order, visit, depth + 1); + inwalkdata(rb_right_child(root, order), order, visit, depth + 1); } @@ -130,21 +130,21 @@ * Perform a postorder traversal of a red-black tree */ HIDDEN void -postwalkdata(struct bu_rb_node *root, int order, void (*visit) (/* ??? */), int depth) +postwalkdata(struct bu_rb_node *root, int order, void (*visit)(/* ??? */), int depth) { BU_CKMAG(root, BU_RB_NODE_MAGIC, "red-black node"); RB_CKORDER(root->rbn_tree, order); if (root == rb_null(root->rbn_tree)) return; - postwalkdata (rb_left_child(root, order), order, visit, depth + 1); - postwalkdata (rb_right_child(root, order), order, visit, depth + 1); + postwalkdata(rb_left_child(root, order), order, visit, depth + 1); + postwalkdata(rb_right_child(root, order), order, visit, depth + 1); visit(rb_data(root, order), depth); } void -rb_walk(struct bu_rb_tree *tree, int order, void (*visit) (/* ??? */), int what_to_visit, int trav_type) +rb_walk(struct bu_rb_tree *tree, int order, void (*visit)(/* ??? */), int what_to_visit, int trav_type) { static void (*walk[][3])() = { { prewalknodes, inwalknodes, postwalknodes }, @@ -161,7 +161,7 @@ case WALK_NODES: case WALK_DATA: (*walk[what_to_visit][trav_type]) - (rb_root(tree, order), order, visit, 0); + (rb_root(tree, order), order, visit, 0); break; default: bu_log("ERROR: rb_walk(): Illegal visitation object: %d\n", @@ -177,7 +177,7 @@ } void -bu_rb_walk(struct bu_rb_tree *tree, int order, void (*visit) (/* ??? */), int trav_type) +bu_rb_walk(struct bu_rb_tree *tree, int order, void (*visit)(/* ??? */), int trav_type) { BU_CKMAG(tree, BU_RB_TREE_MAGIC, "red-black tree"); RB_CKORDER(tree, order); Index: semaphore.c =================================================================== --- semaphore.c (revision 48946) +++ semaphore.c (working copy) @@ -197,7 +197,7 @@ #if defined(convex) || defined(__convex__) HIDDEN void semaphore_convex_acquire(p) - register long *p; +register long *p; { asm("getlck:"); asm(" tas @0(ap)"); /* try to set the lock */ @@ -478,7 +478,8 @@ /* XXX need a routine to pair up with _init() to delete the semaphore structures */ #if 0 void -bu_semaphore_free() { +bu_semaphore_free() +{ if (bu_semaphores) { free(bu_semaphores); bu_semaphores = (struct bu_semaphores *)NULL; Index: rb_insert.c =================================================================== --- rb_insert.c (revision 48946) +++ rb_insert.c (working copy) @@ -60,7 +60,7 @@ */ rb_parent(new_node, order) = rb_left_child(new_node, order) = - rb_right_child(new_node, order) = rb_null(tree); + rb_right_child(new_node, order) = rb_null(tree); rb_size(new_node, order) = 1; if (UNLIKELY(tree->rbt_debug & BU_RB_DEBUG_OS)) bu_log("_rb_insert(%p): size(%p, %d)=%d\n", @@ -111,8 +111,7 @@ parent = rb_parent(node, order); grand_parent = rb_parent(parent, order); while ((node != rb_root(tree, order)) - && (rb_get_color(parent, order) == RB_RED)) - { + && (rb_get_color(parent, order) == RB_RED)) { if (parent == rb_left_child(grand_parent, order)) direction = RB_LEFT; else @@ -172,8 +171,7 @@ */ for (order = 0; order < nm_orders; ++order) { if (rb_get_uniqueness(tree, order) && - (bu_rb_search(tree, order, data) != NULL)) - { + (bu_rb_search(tree, order, data) != NULL)) { if (UNLIKELY(tree->rbt_debug & BU_RB_DEBUG_UNIQ)) bu_log("bu_rb_insert(<%p>, <%p>, TBD) will return %d\n", tree, data, -(order + 1)); @@ -185,13 +183,13 @@ * Make a new package and add it to the list of all packages. */ package = (struct bu_rb_package *) - bu_malloc(sizeof(struct bu_rb_package), "red-black package"); + bu_malloc(sizeof(struct bu_rb_package), "red-black package"); package->rbp_node = (struct bu_rb_node **) - bu_malloc(nm_orders * sizeof(struct bu_rb_node *), - "red-black package nodes"); + bu_malloc(nm_orders * sizeof(struct bu_rb_node *), + "red-black package nodes"); rblp = (struct bu_rb_list *) - bu_malloc(sizeof(struct bu_rb_list), - "red-black list element"); + bu_malloc(sizeof(struct bu_rb_list), + "red-black list element"); rblp->rbl_magic = BU_RB_LIST_MAGIC; rblp->rbl_package = package; BU_LIST_PUSH(&(tree->rbt_packages.l), rblp); @@ -201,28 +199,28 @@ * Make a new node and add it to the list of all nodes. */ node = (struct bu_rb_node *) - bu_malloc(sizeof(struct bu_rb_node), "red-black node"); + bu_malloc(sizeof(struct bu_rb_node), "red-black node"); node->rbn_parent = (struct bu_rb_node **) - bu_malloc(nm_orders * sizeof(struct bu_rb_node *), - "red-black parents"); + bu_malloc(nm_orders * sizeof(struct bu_rb_node *), + "red-black parents"); node->rbn_left = (struct bu_rb_node **) - bu_malloc(nm_orders * sizeof(struct bu_rb_node *), - "red-black left children"); + bu_malloc(nm_orders * sizeof(struct bu_rb_node *), + "red-black left children"); node->rbn_right = (struct bu_rb_node **) - bu_malloc(nm_orders * sizeof(struct bu_rb_node *), - "red-black right children"); + bu_malloc(nm_orders * sizeof(struct bu_rb_node *), + "red-black right children"); node->rbn_color = (char *) - bu_malloc((size_t) ceil((double) (nm_orders / 8.0)), - "red-black colors"); + bu_malloc((size_t) ceil((double)(nm_orders / 8.0)), + "red-black colors"); node->rbn_size = (int *) - bu_malloc(nm_orders * sizeof(int), - "red-black subtree sizes"); + bu_malloc(nm_orders * sizeof(int), + "red-black subtree sizes"); node->rbn_package = (struct bu_rb_package **) - bu_malloc(nm_orders * sizeof(struct bu_rb_package *), - "red-black packages"); + bu_malloc(nm_orders * sizeof(struct bu_rb_package *), + "red-black packages"); rblp = (struct bu_rb_list *) - bu_malloc(sizeof(struct bu_rb_list), - "red-black list element"); + bu_malloc(sizeof(struct bu_rb_list), + "red-black list element"); rblp->rbl_magic = BU_RB_LIST_MAGIC; rblp->rbl_node = node; BU_LIST_PUSH(&(tree->rbt_nodes.l), rblp); @@ -254,7 +252,7 @@ rb_root(tree, order) = node; rb_parent(node, order) = rb_left_child(node, order) = - rb_right_child(node, order) = rb_null(tree); + rb_right_child(node, order) = rb_null(tree); rb_set_color(node, order, RB_BLK); rb_size(node, order) = 1; if (UNLIKELY(tree->rbt_debug & BU_RB_DEBUG_OS)) @@ -338,7 +336,7 @@ rb_set_uniqueness(tree, order, 0); for (order = 0; (flag_rep != 0) && (order < nm_orders); flag_rep >>= 1, - ++order) + ++order) if (flag_rep & 0x1) rb_set_uniqueness(tree, order, 1); Index: rb_search.c =================================================================== --- rb_search.c (revision 48946) +++ rb_search.c (working copy) @@ -41,7 +41,7 @@ * (tree->rbt_empty_node). */ HIDDEN struct bu_rb_node * -_rb_search(struct bu_rb_node *root, int order_nm, int (*order) (/* ??? */), void *data) +_rb_search(struct bu_rb_node *root, int order_nm, int (*order)(/* ??? */), void *data) { int result; struct bu_rb_tree *tree; @@ -66,7 +66,7 @@ } -void *bu_rb_search (struct bu_rb_tree *tree, int order, void *data) +void *bu_rb_search(struct bu_rb_tree *tree, int order, void *data) { int (*compare)(); Index: fchmod.c =================================================================== --- fchmod.c (revision 48946) +++ fchmod.c (working copy) @@ -74,7 +74,7 @@ void* pMem = MapViewOfFile(hFileMap, FILE_MAP_READ, 0, 0, 1); if (pMem) { - if (GetMappedFileName (GetCurrentProcess(), pMem, pszFilename, MAXPATHLEN)) { + if (GetMappedFileName(GetCurrentProcess(), pMem, pszFilename, MAXPATHLEN)) { /* Translate path with device name to drive letters. */ TCHAR szTemp[MAXPATHLEN+1]; @@ -158,7 +158,7 @@ int bu_fchmod_stream(FILE *fp, - unsigned long pmode) + unsigned long pmode) { if (UNLIKELY(!fp)) { return 0; Index: cmd.c =================================================================== --- cmd.c (revision 48946) +++ cmd.c (working copy) @@ -40,8 +40,7 @@ for (ctp = cmds; ctp->ct_name != (char *)NULL; ctp++) { if (ctp->ct_name[0] == argv[cmd_index][0] - && BU_STR_EQUAL(ctp->ct_name, argv[cmd_index])) - { + && BU_STR_EQUAL(ctp->ct_name, argv[cmd_index])) { if (retval) { *retval = (*ctp->ct_func)(data, argc, argv); } else { Index: vls.c =================================================================== --- vls.c (revision 48946) +++ vls.c (working copy) @@ -111,8 +111,7 @@ /* Sanity checking */ if (vp->vls_str == (char *)NULL || - vp->vls_len + vp->vls_offset >= vp->vls_max) - { + vp->vls_len + vp->vls_offset >= vp->vls_max) { bu_log("bu_vls_addr: bad VLS. max=%zu, len=%zu, offset=%zu\n", vp->vls_max, vp->vls_len, vp->vls_offset); bu_bomb("bu_vls_addr\n"); @@ -775,8 +774,7 @@ || *fp == '+' || *fp == '.' || *fp == '-' - || *fp == '*') - { + || *fp == '*') { continue; } if (*fp == 'z') { @@ -800,95 +798,93 @@ /* Grab parameter from arg list, and print it */ switch (*ep) { - case 's': - { - char *str; + case 's': { + char *str; - str = va_arg(ap, char *); - if (str) { - if (flags & FIELDLEN) { - int stringlen = (int)strlen(str); + str = va_arg(ap, char *); + if (str) { + if (flags & FIELDLEN) { + int stringlen = (int)strlen(str); - if (stringlen >= fieldlen) - bu_vls_strncat(vls, str, (size_t)fieldlen); - else { - struct bu_vls padded = BU_VLS_INIT_ZERO; - int i; + if (stringlen >= fieldlen) + bu_vls_strncat(vls, str, (size_t)fieldlen); + else { + struct bu_vls padded = BU_VLS_INIT_ZERO; + int i; - if (left_justify) - bu_vls_strcat(&padded, str); - for (i = 0; i < fieldlen - stringlen; ++i) - bu_vls_putc(&padded, ' '); - if (!left_justify) - bu_vls_strcat(&padded, str); - bu_vls_vlscat(vls, &padded); - } - } else { - bu_vls_strcat(vls, str); + if (left_justify) + bu_vls_strcat(&padded, str); + for (i = 0; i < fieldlen - stringlen; ++i) + bu_vls_putc(&padded, ' '); + if (!left_justify) + bu_vls_strcat(&padded, str); + bu_vls_vlscat(vls, &padded); } - } else { - if (flags & FIELDLEN) - bu_vls_strncat(vls, "(null)", (size_t)fieldlen); - else - bu_vls_strcat(vls, "(null)"); + } else { + bu_vls_strcat(vls, str); } + } else { + if (flags & FIELDLEN) + bu_vls_strncat(vls, "(null)", (size_t)fieldlen); + else + bu_vls_strcat(vls, "(null)"); } - break; + } + break; case 'S': /* XXX - DEPRECATED [7.14] */ printf("DEVELOPER DEPRECATION NOTICE: Using %%S for string printing is deprecated, use %%V instead\n"); /* fall through */ - case 'V': - { - struct bu_vls *vp; + case 'V': { + struct bu_vls *vp; - vp = va_arg(ap, struct bu_vls *); - if (vp) { - BU_CK_VLS(vp); - if (flags & FIELDLEN) { - int stringlen = bu_vls_strlen(vp); + vp = va_arg(ap, struct bu_vls *); + if (vp) { + BU_CK_VLS(vp); + if (flags & FIELDLEN) { + int stringlen = bu_vls_strlen(vp); - if (stringlen >= fieldlen) - bu_vls_strncat(vls, bu_vls_addr(vp), (size_t)fieldlen); - else { - struct bu_vls padded = BU_VLS_INIT_ZERO; - int i; + if (stringlen >= fieldlen) + bu_vls_strncat(vls, bu_vls_addr(vp), (size_t)fieldlen); + else { + struct bu_vls padded = BU_VLS_INIT_ZERO; + int i; - if (left_justify) - bu_vls_vlscat(&padded, vp); - for (i = 0; i < fieldlen - stringlen; ++i) - bu_vls_putc(&padded, ' '); - if (!left_justify) - bu_vls_vlscat(&padded, vp); - bu_vls_vlscat(vls, &padded); - } - } else { - bu_vls_vlscat(vls, vp); + if (left_justify) + bu_vls_vlscat(&padded, vp); + for (i = 0; i < fieldlen - stringlen; ++i) + bu_vls_putc(&padded, ' '); + if (!left_justify) + bu_vls_vlscat(&padded, vp); + bu_vls_vlscat(vls, &padded); } - } else { - if (flags & FIELDLEN) - bu_vls_strncat(vls, "(null)", (size_t)fieldlen); - else - bu_vls_strcat(vls, "(null)"); + } else { + bu_vls_vlscat(vls, vp); } + } else { + if (flags & FIELDLEN) + bu_vls_strncat(vls, "(null)", (size_t)fieldlen); + else + bu_vls_strcat(vls, "(null)"); } - break; + } + break; case 'e': case 'E': case 'f': case 'g': case 'G': /* All floating point ==> "double" */ - { - double d; + { + double d; - d = va_arg(ap, double); - if (flags & FIELDLEN) - snprintf(buf, BUFSIZ, fbuf, fieldlen, d); - else - snprintf(buf, BUFSIZ, fbuf, d); - } - bu_vls_strcat(vls, buf); - break; + d = va_arg(ap, double); + if (flags & FIELDLEN) + snprintf(buf, BUFSIZ, fbuf, fieldlen, d); + else + snprintf(buf, BUFSIZ, fbuf, d); + } + bu_vls_strcat(vls, buf); + break; case 'o': case 'u': case 'x': @@ -1015,34 +1011,33 @@ case 'n': case 'p': /* all pointer == "void *" */ - { - void *vp; - vp = (void *)va_arg(ap, void *); - if (flags & FIELDLEN) - snprintf(buf, BUFSIZ, fbuf, fieldlen, vp); - else - snprintf(buf, BUFSIZ, fbuf, vp); - } - bu_vls_strcat(vls, buf); - break; + { + void *vp; + vp = (void *)va_arg(ap, void *); + if (flags & FIELDLEN) + snprintf(buf, BUFSIZ, fbuf, fieldlen, vp); + else + snprintf(buf, BUFSIZ, fbuf, vp); + } + bu_vls_strcat(vls, buf); + break; case '%': bu_vls_putc(vls, '%'); break; - default: /* Something weird, maybe %c */ - { - int j; + default: { /* Something weird, maybe %c */ + int j; - /* We hope, whatever it is, it fits in an int and the resulting - stringlet is smaller than sizeof(buf) bytes */ + /* We hope, whatever it is, it fits in an int and the resulting + stringlet is smaller than sizeof(buf) bytes */ - j = va_arg(ap, int); - if (flags & FIELDLEN) - snprintf(buf, BUFSIZ, fbuf, fieldlen, j); - else - snprintf(buf, BUFSIZ, fbuf, j); - } - bu_vls_strcat(vls, buf); - break; + j = va_arg(ap, int); + if (flags & FIELDLEN) + snprintf(buf, BUFSIZ, fbuf, fieldlen, j); + else + snprintf(buf, BUFSIZ, fbuf, j); + } + bu_vls_strcat(vls, buf); + break; } sp = ep+1; } Index: mappedfile.c =================================================================== --- mappedfile.c (revision 48946) +++ mappedfile.c (working copy) @@ -314,7 +314,7 @@ if (UNLIKELY(bu_debug&BU_DEBUG_MAPPED_FILE)) bu_log("bu_open_mapped_file(%s, %s) can't open file\n", - real_path, appl?appl:"(NIL)"); + real_path, appl?appl:"(NIL)"); if (real_path) { bu_free(real_path, "real_path alloc from bu_realpath"); Index: progname.c =================================================================== --- progname.c (revision 48946) +++ progname.c (working copy) @@ -174,7 +174,8 @@ const char * -bu_getprogname(void) { +bu_getprogname(void) +{ const char *name = NULL; char *tmp_basename = NULL; Index: parse.c =================================================================== --- parse.c (revision 48946) +++ parse.c (working copy) @@ -134,16 +134,15 @@ loc = ((char *)base) + ip->sp_offset; switch (ip->sp_fmt[0]) { - case 'i': - { - /* DEPRECATED: use %p instead. */ - static int warned = 0; - if (!warned) { - bu_log("DEVELOPER DEPRECATION NOTICE: Use of \"i\" is replaced by \"%%p\" for chained bu_structparse tables.\n"); - warned++; - } + case 'i': { + /* DEPRECATED: use %p instead. */ + static int warned = 0; + if (!warned) { + bu_log("DEVELOPER DEPRECATION NOTICE: Use of \"i\" is replaced by \"%%p\" for chained bu_structparse tables.\n"); + warned++; } - continue; + } + continue; case '%': /* See below */ break; @@ -191,63 +190,60 @@ } } continue; - case 's': - { - /* char array is transmitted as a 4 byte character - * count, followed by a null terminated, word - * padded char array. The count includes any pad - * bytes, but not the count itself. - * - * ip->sp_count == sizeof(char array) - */ - register size_t lenstr; + case 's': { + /* char array is transmitted as a 4 byte character + * count, followed by a null terminated, word + * padded char array. The count includes any pad + * bytes, but not the count itself. + * + * ip->sp_count == sizeof(char array) + */ + register size_t lenstr; - /* include the terminating null */ - lenstr = (int)strlen(loc) + 1; + /* include the terminating null */ + lenstr = (int)strlen(loc) + 1; - len = lenstr; + len = lenstr; - /* output an integer number of words */ - if ((len & 0x03) != 0) - len += 4 - (len & 0x03); + /* output an integer number of words */ + if ((len & 0x03) != 0) + len += 4 - (len & 0x03); - CKMEM(len + 4); + CKMEM(len + 4); - /* put the length on the front of the string - */ - cp[3] = (char)len; - cp[2] = (char)(len >> 8); - cp[1] = (char)(len >> 16); - cp[0] = (char)(len >> 24); + /* put the length on the front of the string + */ + cp[3] = (char)len; + cp[2] = (char)(len >> 8); + cp[1] = (char)(len >> 16); + cp[0] = (char)(len >> 24); - cp += 4; + cp += 4; - memcpy(cp, loc, lenstr); - cp += lenstr; - while (lenstr++ < len) *cp++ = '\0'; - } - continue; - case 'c': - { - CKMEM(ip->sp_count + 4); - cp[3] = (char)ip->sp_count; - cp[2] = (char)(ip->sp_count >> 8); - cp[1] = (char)(ip->sp_count >> 16); - cp[0] = (char)(ip->sp_count >> 24); - cp += 4; - memcpy(cp, loc, ip->sp_count); - cp += ip->sp_count; - } - continue; - case 'p': - { - BU_ASSERT(ip->sp_count == 1); + memcpy(cp, loc, lenstr); + cp += lenstr; + while (lenstr++ < len) *cp++ = '\0'; + } + continue; + case 'c': { + CKMEM(ip->sp_count + 4); + cp[3] = (char)ip->sp_count; + cp[2] = (char)(ip->sp_count >> 8); + cp[1] = (char)(ip->sp_count >> 16); + cp[0] = (char)(ip->sp_count >> 24); + cp += 4; + memcpy(cp, loc, ip->sp_count); + cp += ip->sp_count; + } + continue; + case 'p': { + BU_ASSERT(ip->sp_count == 1); - /* Indirect to another structure */ - /* FIXME: unimplemented */ - bu_log("INTERNAL ERROR: attempt to indirectly export bu_structparse table, unimplemented\n"); - } - continue; + /* Indirect to another structure */ + /* FIXME: unimplemented */ + bu_log("INTERNAL ERROR: attempt to indirectly export bu_structparse table, unimplemented\n"); + } + continue; default: bu_free((char *) ext->ext_buf, "output ext_buf"); return 0; @@ -287,16 +283,15 @@ loc = ((char *)base) + ip->sp_offset; switch (ip->sp_fmt[0]) { - case 'i': - { - /* DEPRECATED: use %p instead. */ - static int warned = 0; - if (!warned) { - bu_log("DEVELOPER DEPRECATION NOTICE: Use of \"i\" is replaced by \"%%p\" for chained bu_structparse tables.\n"); - warned++; - } + case 'i': { + /* DEPRECATED: use %p instead. */ + static int warned = 0; + if (!warned) { + bu_log("DEVELOPER DEPRECATION NOTICE: Use of \"i\" is replaced by \"%%p\" for chained bu_structparse tables.\n"); + warned++; } - continue; + } + continue; case '%': /* See below */ break; @@ -315,82 +310,80 @@ break; case 'd': /* 32-bit network integer, from "int" */ - { - register long l; - for (i = ip->sp_count; i > 0; i--) { - l = - ((long)cp[0] << 24) | - ((long)cp[1] << 16) | - ((long)cp[2] << 8) | - (long)cp[3]; - *(int *)loc = l; - loc += sizeof(int); /* XXX */ - cp += 4; - } - bytes_used += ip->sp_count * 4; + { + register long l; + for (i = ip->sp_count; i > 0; i--) { + l = + ((long)cp[0] << 24) | + ((long)cp[1] << 16) | + ((long)cp[2] << 8) | + (long)cp[3]; + *(int *)loc = l; + loc += sizeof(int); /* XXX */ + cp += 4; } - break; + bytes_used += ip->sp_count * 4; + } + break; case 'i': /* 16-bit integer, from "int" */ for (i = ip->sp_count; i > 0; i--) { *(int *)loc = (cp[0] << 8) | - cp[1]; + cp[1]; loc += sizeof(int); /* XXX */ cp += 2; } bytes_used += ip->sp_count * 2; break; - case 's': - { - /* char array transmitted as a 4 byte character - * count, followed by a null terminated, word - * padded char array - * - * ip->sp_count == sizeof(char array) - */ - register unsigned long lenstr; + case 's': { + /* char array transmitted as a 4 byte character + * count, followed by a null terminated, word + * padded char array + * + * ip->sp_count == sizeof(char array) + */ + register unsigned long lenstr; - lenstr = - ((unsigned long)cp[0] << 24) | - ((unsigned long)cp[1] << 16) | - ((unsigned long)cp[2] << 8) | - ((unsigned long)cp[3]); + lenstr = + ((unsigned long)cp[0] << 24) | + ((unsigned long)cp[1] << 16) | + ((unsigned long)cp[2] << 8) | + ((unsigned long)cp[3]); - cp += 4; + cp += 4; - /* don't read more than the buffer can hold */ - if ((unsigned long)ip->sp_count < lenstr) - memcpy(loc, cp, ip->sp_count); - else - memcpy(loc, cp, lenstr); + /* don't read more than the buffer can hold */ + if ((unsigned long)ip->sp_count < lenstr) + memcpy(loc, cp, ip->sp_count); + else + memcpy(loc, cp, lenstr); - /* ensure proper null termination */ - loc[ip->sp_count-1] = '\0'; + /* ensure proper null termination */ + loc[ip->sp_count-1] = '\0'; - cp += lenstr; - bytes_used += lenstr; - } - break; - case 'c': - { - register unsigned long lenarray; + cp += lenstr; + bytes_used += lenstr; + } + break; + case 'c': { + register unsigned long lenarray; - lenarray = - ((unsigned long)cp[0] << 24) | - ((unsigned long)cp[1] << 16) | - ((unsigned long)cp[2] << 8) | - ((unsigned long)cp[3]); - cp += 4; + lenarray = + ((unsigned long)cp[0] << 24) | + ((unsigned long)cp[1] << 16) | + ((unsigned long)cp[2] << 8) | + ((unsigned long)cp[3]); + cp += 4; - if ((unsigned long)ip->sp_count < lenarray) { - memcpy(loc, cp, ip->sp_count); - } else { - memcpy(loc, cp, lenarray); - } - cp += lenarray; - bytes_used += lenarray; + if ((unsigned long)ip->sp_count < lenarray) { + memcpy(loc, cp, ip->sp_count); + } else { + memcpy(loc, cp, lenarray); } - break; + cp += lenarray; + bytes_used += lenarray; + } + break; case 'p': BU_ASSERT(ip->sp_count == 1); @@ -448,9 +441,9 @@ | ((unsigned char *)(ext->ext_buf))[1]; len = (((unsigned char *)(ext->ext_buf))[2] << 24) - | (((unsigned char *)(ext->ext_buf))[3] << 16) - | (((unsigned char *)(ext->ext_buf))[4] << 8) - | (((unsigned char *)(ext->ext_buf))[5]); + | (((unsigned char *)(ext->ext_buf))[3] << 16) + | (((unsigned char *)(ext->ext_buf))[4] << 8) + | (((unsigned char *)(ext->ext_buf))[5]); if (UNLIKELY(i != BU_GETPUT_MAGIC_1)) { bu_log("ERROR: bad getput buffer header %p, s/b %x, was %s(0x%lx), file %s, line %d\n", @@ -500,7 +493,7 @@ ext->ext_buf = buf; i = ((long)((unsigned char *)(ext->ext_buf))[0] << 8) | ((long)((unsigned char *)(ext->ext_buf))[1]); - len = + len = ((long)((unsigned char *)(ext->ext_buf))[2] << 24) | ((long)((unsigned char *)(ext->ext_buf))[3] << 16) | ((long)((unsigned char *)(ext->ext_buf))[4] << 8) | @@ -658,134 +651,130 @@ switch (sdp->sp_fmt[1]) { case 'c': - case 's': - { - register size_t j; + case 's': { + register size_t j; - /* copy the string, converting escaped double - * quotes to just double quotes - */ - for (i=j=0; - j < sdp->sp_count && value[i] != '\0'; - loc[j++] = value[i++]) - if (value[i] == '\\' && - value[i+1] == '"') - ++i; + /* copy the string, converting escaped double + * quotes to just double quotes + */ + for (i=j=0; + j < sdp->sp_count && value[i] != '\0'; + loc[j++] = value[i++]) + if (value[i] == '\\' && + value[i+1] == '"') + ++i; - /* Don't null terminate chars, only strings */ - if (sdp->sp_count > 1) { - /* OK, it's a string */ - if (j < sdp->sp_count-1) - loc[j] = '\0'; - else - loc[sdp->sp_count-1] = '\0'; - } + /* Don't null terminate chars, only strings */ + if (sdp->sp_count > 1) { + /* OK, it's a string */ + if (j < sdp->sp_count-1) + loc[j] = '\0'; + else + loc[sdp->sp_count-1] = '\0'; } - break; + } + break; case 'S': /* XXX - DEPRECATED [7.14] */ printf("DEVELOPER DEPRECATION NOTICE: Using %%S for string printing is deprecated, use %%V instead\n"); /* fall through */ - case 'V': - { - struct bu_vls *vls = (struct bu_vls *)loc; - bu_vls_strcpy(vls, value); - } - break; - case 'i': - { - register short *ip = (short *)loc; - register short tmpi; - register const char *cp; - register const char *pv = value; + case 'V': { + struct bu_vls *vls = (struct bu_vls *)loc; + bu_vls_strcpy(vls, value); + } + break; + case 'i': { + register short *ip = (short *)loc; + register short tmpi; + register const char *cp; + register const char *pv = value; - for (i=0; i < sdp->sp_count && *pv; ++i) { - tmpi = atoi(pv); + for (i=0; i < sdp->sp_count && *pv; ++i) { + tmpi = atoi(pv); - cp = pv; - if (*cp && (*cp == '+' || *cp == '-')) - cp++; + cp = pv; + if (*cp && (*cp == '+' || *cp == '-')) + cp++; - while (*cp && isdigit(*cp)) - cp++; + while (*cp && isdigit(*cp)) + cp++; - /* make sure we actually had an - * integer out there - */ - if (cp == pv || - (cp == pv+1 && - (*pv == '+' || *pv == '-'))) { - retval = -2; - break; - } else { - *(ip++) = tmpi; - pv = cp; - } + /* make sure we actually had an + * integer out there + */ + if (cp == pv || + (cp == pv+1 && + (*pv == '+' || *pv == '-'))) { + retval = -2; + break; + } else { + *(ip++) = tmpi; + pv = cp; + } - /* skip any whitespace before separator */ - while (*pv && isspace(*pv)) - pv++; + /* skip any whitespace before separator */ + while (*pv && isspace(*pv)) + pv++; - /* skip the separator */ - if (*pv && !isdigit(*pv) && *pv != '+' && *pv != '-') - pv++; + /* skip the separator */ + if (*pv && !isdigit(*pv) && *pv != '+' && *pv != '-') + pv++; - /* skip any whitespace after separator */ - while (*pv && isspace(*pv)) - pv++; - } + /* skip any whitespace after separator */ + while (*pv && isspace(*pv)) + pv++; } - break; - case 'd': - { - register int *ip = (int *)loc; - register int tmpi; - register char const *cp; - register const char *pv = value; + } + break; + case 'd': { + register int *ip = (int *)loc; + register int tmpi; + register char const *cp; + register const char *pv = value; - /* Special case: '=!' toggles a boolean */ - if (*pv == '!') { - *ip = *ip ? 0 : 1; - pv++; - break; - } - /* Normal case: an integer */ - for (i=0; i < sdp->sp_count && *pv; ++i) { - tmpi = atoi(pv); + /* Special case: '=!' toggles a boolean */ + if (*pv == '!') { + *ip = *ip ? 0 : 1; + pv++; + break; + } + /* Normal case: an integer */ + for (i=0; i < sdp->sp_count && *pv; ++i) { + tmpi = atoi(pv); - cp = pv; - if (*cp && (*cp == '+' || *cp == '-')) - cp++; + cp = pv; + if (*cp && (*cp == '+' || *cp == '-')) + cp++; - while (*cp && isdigit(*cp)) - cp++; + while (*cp && isdigit(*cp)) + cp++; - /* make sure we actually had an - * integer out there - */ - if (cp == pv || - (cp == pv+1 && - (*pv == '+' || *pv == '-'))) { - retval = -2; - break; - } else { - *(ip++) = tmpi; - pv = cp; - } + /* make sure we actually had an + * integer out there + */ + if (cp == pv || + (cp == pv+1 && + (*pv == '+' || *pv == '-'))) { + retval = -2; + break; + } else { + *(ip++) = tmpi; + pv = cp; + } - /* skip any whitespace before separator */ - while (*pv && isspace(*pv)) - pv++; + /* skip any whitespace before separator */ + while (*pv && isspace(*pv)) + pv++; - /* skip the separator */ - if (*pv && !isdigit(*pv) && *pv != '+' && *pv != '-') - pv++; + /* skip the separator */ + if (*pv && !isdigit(*pv) && *pv != '+' && *pv != '-') + pv++; - /* skip any whitespace after separator */ - while (*pv && isspace(*pv)) - pv++; - } + /* skip any whitespace after separator */ + while (*pv && isspace(*pv)) + pv++; } - break; + } + break; case 'f': retval = parse_double(value, sdp->sp_count, (double *)loc); break; @@ -934,8 +923,8 @@ HIDDEN void parse_vls_matprint(struct bu_vls *vls, - const char *name, - register const double *mat) + const char *name, + register const double *mat) { int delta = (int)strlen(name)+2; @@ -1001,57 +990,51 @@ case 'S': /* XXX - DEPRECATED [7.14] */ printf("DEVELOPER DEPRECATION NOTICE: Using %%S for string printing is deprecated, use %%V instead\n"); /* fall through */ - case 'V': - { - struct bu_vls *vls = (struct bu_vls *)loc; - bu_vls_vlscat(vp, vls); - } - break; - case 'i': - { - register size_t i = sdp->sp_count; - register short *sp = (short *)loc; + case 'V': { + struct bu_vls *vls = (struct bu_vls *)loc; + bu_vls_vlscat(vp, vls); + } + break; + case 'i': { + register size_t i = sdp->sp_count; + register short *sp = (short *)loc; - bu_vls_printf(vp, "%d", *sp++); - while (--i > 0) bu_vls_printf(vp, "%c%d", sep_char, *sp++); - } - break; - case 'd': - { - register size_t i = sdp->sp_count; - register int *dp = (int *)loc; + bu_vls_printf(vp, "%d", *sp++); + while (--i > 0) bu_vls_printf(vp, "%c%d", sep_char, *sp++); + } + break; + case 'd': { + register size_t i = sdp->sp_count; + register int *dp = (int *)loc; - bu_vls_printf(vp, "%d", *dp++); - while (--i > 0) bu_vls_printf(vp, "%c%d", sep_char, *dp++); - } - break; - case 'f': - { - register size_t i = sdp->sp_count; - register double *dp = (double *)loc; + bu_vls_printf(vp, "%d", *dp++); + while (--i > 0) bu_vls_printf(vp, "%c%d", sep_char, *dp++); + } + break; + case 'f': { + register size_t i = sdp->sp_count; + register double *dp = (double *)loc; - bu_vls_printf(vp, "%.25G", *dp++); - while (--i > 0) bu_vls_printf(vp, "%c%.25G", sep_char, *dp++); - } - break; - case 'x': - { - register size_t i = sdp->sp_count; - register int *dp = (int *)loc; + bu_vls_printf(vp, "%.25G", *dp++); + while (--i > 0) bu_vls_printf(vp, "%c%.25G", sep_char, *dp++); + } + break; + case 'x': { + register size_t i = sdp->sp_count; + register int *dp = (int *)loc; - bu_vls_printf(vp, "%08x", *dp++); - while (--i > 0) bu_vls_printf(vp, "%c%08x", sep_char, *dp++); - } - break; - case 'p': - { - BU_ASSERT(sdp->sp_count == 1); + bu_vls_printf(vp, "%08x", *dp++); + while (--i > 0) bu_vls_printf(vp, "%c%08x", sep_char, *dp++); + } + break; + case 'p': { + BU_ASSERT(sdp->sp_count == 1); - /* Indirect to another structure */ - /* FIXME: unimplemented */ - bu_log("INTERNAL ERROR: Cannot print type '%%p' yet!\n"); - } - break; + /* Indirect to another structure */ + /* FIXME: unimplemented */ + bu_log("INTERNAL ERROR: Cannot print type '%%p' yet!\n"); + } + break; default: break; } @@ -1133,96 +1116,90 @@ case 'S': /* XXX - DEPRECATED [7.14] */ printf("DEVELOPER DEPRECATION NOTICE: Using %%S for string printing is deprecated, use %%V instead\n"); /* fall through */ - case 'V': - { - struct bu_vls *vls = (struct bu_vls *)loc; + case 'V': { + struct bu_vls *vls = (struct bu_vls *)loc; - bu_log("\t%s=\"%V\"\n", sdp->sp_name, vls); - bu_log("\t\t(vls_magic)0x%lx (vls_offset)%zu (vls_len)%zu (vls_max)%zu\n", - vls->vls_magic, vls->vls_offset, vls->vls_len, vls->vls_max); + bu_log("\t%s=\"%V\"\n", sdp->sp_name, vls); + bu_log("\t\t(vls_magic)0x%lx (vls_offset)%zu (vls_len)%zu (vls_max)%zu\n", + vls->vls_magic, vls->vls_offset, vls->vls_len, vls->vls_max); + } + break; + case 'i': { + register short *sp = (short *)loc; + + bu_log("\t%s=%d", sdp->sp_name, *sp++); + + for (i=1; i < sdp->sp_count; i++) { + bu_log("%c%d", COMMA, *sp++); } - break; - case 'i': - { - register short *sp = (short *)loc; - bu_log("\t%s=%d", sdp->sp_name, *sp++); + bu_log("\n"); + } + break; + case 'd': { + register int *dp = (int *)loc; - for (i=1; i < sdp->sp_count; i++) { - bu_log("%c%d", COMMA, *sp++); - } + bu_log("\t%s=%d", sdp->sp_name, *dp++); - bu_log("\n"); + for (i=1; i < sdp->sp_count; i++) { + bu_log("%c%d", COMMA, *dp++); } - break; - case 'd': - { - register int *dp = (int *)loc; - bu_log("\t%s=%d", sdp->sp_name, *dp++); + bu_log("\n"); + } + break; + case 'f': { + register double *dp = (double *)loc; + if (sdp->sp_count == 16) { + parse_matprint(sdp->sp_name, dp); + } else if (sdp->sp_count <= 3) { + bu_log("\t%s=%.25G", sdp->sp_name, *dp++); + for (i=1; i < sdp->sp_count; i++) { - bu_log("%c%d", COMMA, *dp++); + bu_log("%c%.25G", COMMA, *dp++); } bu_log("\n"); - } - break; - case 'f': - { - register double *dp = (double *)loc; + } else { + int delta = (int)strlen(sdp->sp_name)+2; - if (sdp->sp_count == 16) { - parse_matprint(sdp->sp_name, dp); - } else if (sdp->sp_count <= 3) { - bu_log("\t%s=%.25G", sdp->sp_name, *dp++); + bu_log_indent_delta(delta); - for (i=1; i < sdp->sp_count; i++) { - bu_log("%c%.25G", COMMA, *dp++); - } + bu_log("\t%s=%.25G\n", sdp->sp_name, *dp++); - bu_log("\n"); - } else { - int delta = (int)strlen(sdp->sp_name)+2; + /* print first and last value individually, so + * don't iterate over them. + */ + for (i=1; i < sdp->sp_count-1; i++) { + bu_log("%.25G\n", *dp++); + } - bu_log_indent_delta(delta); + bu_log_indent_delta(-delta); + bu_log("%.25G\n", *dp); + } + } + break; + case 'x': { + register int *dp = (int *)loc; - bu_log("\t%s=%.25G\n", sdp->sp_name, *dp++); + bu_log("\t%s=%08x", sdp->sp_name, *dp++); - /* print first and last value individually, so - * don't iterate over them. - */ - for (i=1; i < sdp->sp_count-1; i++) { - bu_log("%.25G\n", *dp++); - } - - bu_log_indent_delta(-delta); - bu_log("%.25G\n", *dp); - } + for (i=1; i < sdp->sp_count; i++) { + bu_log("%c%08x", COMMA, *dp++); } - break; - case 'x': - { - register int *dp = (int *)loc; - bu_log("\t%s=%08x", sdp->sp_name, *dp++); + bu_log("\n"); + } + break; + case 'p': { + struct bu_structparse *tbl = (struct bu_structparse *)sdp->sp_offset; - for (i=1; i < sdp->sp_count; i++) { - bu_log("%c%08x", COMMA, *dp++); - } + BU_ASSERT(sdp->sp_count == 1); - bu_log("\n"); - } + bu_struct_print(sdp->sp_name, tbl, base); break; - case 'p': - { - struct bu_structparse *tbl = (struct bu_structparse *)sdp->sp_offset; - - BU_ASSERT(sdp->sp_count == 1); - - bu_struct_print(sdp->sp_name, tbl, base); - break; - } + } default: bu_log("bu_struct_print: Unknown format: %s=%s ??\n", sdp->sp_name, sdp->sp_fmt); break; @@ -1340,64 +1317,60 @@ case 'S': /* XXX - DEPRECATED [7.14] */ printf("DEVELOPER DEPRECATION NOTICE: Using %%S for string printing is deprecated, use %%V instead\n"); /* fall through */ - case 'V': - { - struct bu_vls *vls_p = (struct bu_vls *)loc; - bu_vls_printf(vls, "%s=\"%V\"", sdp->sp_name, vls_p); - } - break; - case 'i': - { - register size_t i = sdp->sp_count; - register short *sp = (short *)loc; - register int tmpi; + case 'V': { + struct bu_vls *vls_p = (struct bu_vls *)loc; + bu_vls_printf(vls, "%s=\"%V\"", sdp->sp_name, vls_p); + } + break; + case 'i': { + register size_t i = sdp->sp_count; + register short *sp = (short *)loc; + register int tmpi; - increase = 64 * i + strlen(sdp->sp_name) + 3; - bu_vls_extend(vls, (unsigned int)increase); + increase = 64 * i + strlen(sdp->sp_name) + 3; + bu_vls_extend(vls, (unsigned int)increase); - cp = vls->vls_str + vls->vls_offset + vls->vls_len; - snprintf(cp, increase, "%s%s=%d", - (vls->vls_len?" ":""), - sdp->sp_name, *sp++); + cp = vls->vls_str + vls->vls_offset + vls->vls_len; + snprintf(cp, increase, "%s%s=%d", + (vls->vls_len?" ":""), + sdp->sp_name, *sp++); + tmpi = (int)strlen(cp); + vls->vls_len += tmpi; + + while (--i > 0) { + cp += tmpi; + sprintf(cp, "%c%d", COMMA, *sp++); tmpi = (int)strlen(cp); vls->vls_len += tmpi; - - while (--i > 0) { - cp += tmpi; - sprintf(cp, "%c%d", COMMA, *sp++); - tmpi = (int)strlen(cp); - vls->vls_len += tmpi; - } } - break; - case 'd': - { - register size_t i = sdp->sp_count; - register int *dp = (int *)loc; + } + break; + case 'd': { + register size_t i = sdp->sp_count; + register int *dp = (int *)loc; - bu_vls_printf(vls, "%s%s=%d", " ", sdp->sp_name, *dp++); + bu_vls_printf(vls, "%s%s=%d", " ", sdp->sp_name, *dp++); - while (--i > 0) { - bu_vls_printf(vls, "%c%d", COMMA, *dp++); - } + while (--i > 0) { + bu_vls_printf(vls, "%c%d", COMMA, *dp++); } - break; + } + break; case 'f': parse_vls_print_double(vls, sdp->sp_name, sdp->sp_count, - (double *)loc); + (double *)loc); break; - case 'p': - { - struct bu_vls sub_str = BU_VLS_INIT_ZERO; + case 'p': { + struct bu_vls sub_str = BU_VLS_INIT_ZERO; - BU_ASSERT(sdp->sp_count == 1); + BU_ASSERT(sdp->sp_count == 1); - bu_vls_struct_print(&sub_str, (struct bu_structparse *)sdp->sp_offset, base); - bu_vls_vlscat(vls, &sub_str); - bu_vls_free(&sub_str); - continue; - } + bu_vls_struct_print(&sub_str, (struct bu_structparse *)sdp->sp_offset, base); + bu_vls_vlscat(vls, &sub_str); + bu_vls_free(&sub_str); + continue; + } default: bu_log("\t%s=%s ??\n", sdp->sp_name, sdp->sp_fmt); @@ -1464,88 +1437,83 @@ case 'S': /* XXX - DEPRECATED [7.14] */ printf("DEVELOPER DEPRECATION NOTICE: Using %%S for string printing is deprecated, use %%V instead\n"); /* fall through */ - case 'V': - { - struct bu_vls *vls = (struct bu_vls *)loc; + case 'V': { + struct bu_vls *vls = (struct bu_vls *)loc; - bu_vls_printf(vls_out, "\t%s=\"%V\"\n", sdp->sp_name, vls); - bu_vls_printf(vls_out, "\t\t(vls_magic)%ld (vls_offset)%zu (vls_len)%zu (vls_max)%zu\n", - vls->vls_magic, vls->vls_offset, vls->vls_len, vls->vls_max); - } - break; - case 'i': - { - register size_t i = sdp->sp_count; - register short *sp = (short *)loc; + bu_vls_printf(vls_out, "\t%s=\"%V\"\n", sdp->sp_name, vls); + bu_vls_printf(vls_out, "\t\t(vls_magic)%ld (vls_offset)%zu (vls_len)%zu (vls_max)%zu\n", + vls->vls_magic, vls->vls_offset, vls->vls_len, vls->vls_max); + } + break; + case 'i': { + register size_t i = sdp->sp_count; + register short *sp = (short *)loc; - bu_vls_printf(vls_out, "\t%s=%d", sdp->sp_name, *sp++); + bu_vls_printf(vls_out, "\t%s=%d", sdp->sp_name, *sp++); - while (--i > 0) - bu_vls_printf(vls_out, "%c%d", COMMA, *sp++); + while (--i > 0) + bu_vls_printf(vls_out, "%c%d", COMMA, *sp++); - bu_vls_printf(vls_out, "\n"); - } - break; - case 'd': - { - register size_t i = sdp->sp_count; - register int *dp = (int *)loc; + bu_vls_printf(vls_out, "\n"); + } + break; + case 'd': { + register size_t i = sdp->sp_count; + register int *dp = (int *)loc; - bu_vls_printf(vls_out, "\t%s=%d", sdp->sp_name, *dp++); + bu_vls_printf(vls_out, "\t%s=%d", sdp->sp_name, *dp++); - while (--i > 0) - bu_vls_printf(vls_out, "%c%d", COMMA, *dp++); + while (--i > 0) + bu_vls_printf(vls_out, "%c%d", COMMA, *dp++); - bu_vls_printf(vls_out, "\n"); - } - break; - case 'f': - { - register size_t i = sdp->sp_count; - register double *dp = (double *)loc; + bu_vls_printf(vls_out, "\n"); + } + break; + case 'f': { + register size_t i = sdp->sp_count; + register double *dp = (double *)loc; - if (sdp->sp_count == 16) { - parse_vls_matprint(vls_out, sdp->sp_name, dp); - } else if (sdp->sp_count <= 3) { - bu_vls_printf(vls_out, "\t%s=%.25G", sdp->sp_name, *dp++); + if (sdp->sp_count == 16) { + parse_vls_matprint(vls_out, sdp->sp_name, dp); + } else if (sdp->sp_count <= 3) { + bu_vls_printf(vls_out, "\t%s=%.25G", sdp->sp_name, *dp++); - while (--i > 0) - bu_vls_printf(vls_out, "%c%.25G", COMMA, *dp++); + while (--i > 0) + bu_vls_printf(vls_out, "%c%.25G", COMMA, *dp++); - bu_vls_printf(vls_out, "\n"); - } else { - int delta = (int)strlen(sdp->sp_name)+2; + bu_vls_printf(vls_out, "\n"); + } else { + int delta = (int)strlen(sdp->sp_name)+2; - bu_log_indent_delta(delta); - bu_vls_printf(vls_out, "\t%s=%.25G\n", sdp->sp_name, *dp++); - bu_log_indent_vls(vls_out); + bu_log_indent_delta(delta); + bu_vls_printf(vls_out, "\t%s=%.25G\n", sdp->sp_name, *dp++); + bu_log_indent_vls(vls_out); - /* print first and last value individually, so - * don't iterate over them. - */ - while (--i > 1) { - bu_vls_printf(vls_out, "%.25G\n", *dp++); - bu_log_indent_vls(vls_out); - } - - bu_log_indent_delta(-delta); - bu_vls_printf(vls_out, "%.25G\n", *dp); + /* print first and last value individually, so + * don't iterate over them. + */ + while (--i > 1) { + bu_vls_printf(vls_out, "%.25G\n", *dp++); + bu_log_indent_vls(vls_out); } + + bu_log_indent_delta(-delta); + bu_vls_printf(vls_out, "%.25G\n", *dp); } - break; - case 'x': - { - register size_t i = sdp->sp_count; - register int *dp = (int *)loc; + } + break; + case 'x': { + register size_t i = sdp->sp_count; + register int *dp = (int *)loc; - bu_vls_printf(vls_out, "\t%s=%08x", sdp->sp_name, *dp++); + bu_vls_printf(vls_out, "\t%s=%08x", sdp->sp_name, *dp++); - while (--i > 0) - bu_vls_printf(vls_out, "%c%08x", COMMA, *dp++); + while (--i > 0) + bu_vls_printf(vls_out, "%c%08x", COMMA, *dp++); - bu_vls_printf(vls_out, "\n"); - } - break; + bu_vls_printf(vls_out, "\n"); + } + break; case 'p': BU_ASSERT(sdp->sp_count == 1); @@ -1762,7 +1730,7 @@ bu_free(copy, BU_FLSTR); return 0; } - + if (shader_name_len == 6 && !strncmp(shader, "envmap", 6)) { bu_vls_strcat(vls, "envmap {"); if (bu_shader_to_list(iptr, vls)) { @@ -1875,8 +1843,7 @@ while (*ptr && (!isspace(*ptr) || *prev == '\\') && (*ptr != '}' || *prev == '\\') && - (*ptr != '{' || *prev == '\\')) - { + (*ptr != '{' || *prev == '\\')) { prev = ptr; ptr++; } @@ -1959,8 +1926,7 @@ while (*ptr && (!isspace(*ptr) || *prev == '\\') && (*ptr != '}' || *prev == '\\') && - (*ptr != '{' || *prev == '\\')) - { + (*ptr != '{' || *prev == '\\')) { prev = ptr; ptr++; } @@ -2300,33 +2266,32 @@ case 'S': /* XXX - DEPRECATED [7.14] */ printf("DEVELOPER DEPRECATION NOTICE: Using %%S for string printing is deprecated, use %%V instead\n"); /* fall through */ - case 'V': - { - /* copy the string to a bu_vls (string of - * variable length provided by libbu) - */ - struct bu_vls *vls = (struct bu_vls *)loc; + case 'V': { + /* copy the string to a bu_vls (string of + * variable length provided by libbu) + */ + struct bu_vls *vls = (struct bu_vls *)loc; - /* argv[0] contains the string. i.e., we have - * exactly one value - */ - BU_ASSERT(sdp->sp_count == 1); + /* argv[0] contains the string. i.e., we have + * exactly one value + */ + BU_ASSERT(sdp->sp_count == 1); - if (argc < 1) { - bu_vls_printf(logstr, - "not enough values for \"%V\" argument: should be %ld", - sdp->sp_name, - sdp->sp_count); - return BRLCAD_ERROR; - } + if (argc < 1) { + bu_vls_printf(logstr, + "not enough values for \"%V\" argument: should be %ld", + sdp->sp_name, + sdp->sp_count); + return BRLCAD_ERROR; + } - bu_vls_printf(logstr, "%s ", sdp->sp_name); + bu_vls_printf(logstr, "%s ", sdp->sp_name); - bu_vls_strcpy(vls, argv[0]); + bu_vls_strcpy(vls, argv[0]); - bu_vls_printf(logstr, "%s ", argv[0]); - break; - } + bu_vls_printf(logstr, "%s ", argv[0]); + break; + } case 'i': { register short *sh = (short *)loc; register int tmpi; Index: file.c =================================================================== --- file.c (revision 48946) +++ file.c (working copy) @@ -286,8 +286,7 @@ || BU_STR_EQUAL(path, "") || BU_STR_EQUAL(path, ".") || BU_STR_EQUAL(path, "..") - || !bu_file_exists(path, &fd)) - { + || !bu_file_exists(path, &fd)) { return 0; } Index: convert.c =================================================================== --- convert.c (revision 48946) +++ convert.c (working copy) @@ -137,8 +137,7 @@ snprintf(cp, buflen, "%d", cookie & CV_CHANNEL_MASK); len = strlen(cp); cp += len; - if (UNLIKELY(buflen < len)) - { + if (UNLIKELY(buflen < len)) { fprintf(stderr, "bu_cv_pr_cookie: call me with a bigger buffer\n"); return; } @@ -283,7 +282,8 @@ register int fmt = (cookie & CV_TYPE_MASK) >> CV_TYPE_SHIFT; static int host_size_table[8] = {0, sizeof(char), sizeof(short), sizeof(int), - sizeof(long int), sizeof(double)}; + sizeof(long int), sizeof(double) + }; static int net_size_table[8] = {0, 1, 2, 4, 8, 8}; if (cookie & CV_HOST_MASK) @@ -325,7 +325,7 @@ for (i=0; itype = BU_LEX_INT; sscanf(unit, "%x", (unsigned int *)&token->t_int.value); @@ -231,10 +233,10 @@ * *cp should be a '.' */ if (*cp == '.') { - for (cp++;*cp &&isdigit(*cp);cp++); + for (cp++; *cp &&isdigit(*cp); cp++); if (*cp == 'e' || *cp == 'E') cp++; if (*cp == '+' || *cp == '-') cp++; - for (;*cp &&isdigit(*cp);cp++); + for (; *cp &&isdigit(*cp); cp++); if (!*cp) { token->type = BU_LEX_DOUBLE; sscanf(unit, "%lg", &token->t_dbl.value); @@ -254,7 +256,7 @@ if (!*(unit+1)) { /* single character, good choice for a symbol. */ register struct bu_lex_key *sp; - for (sp=symbols;sp->tok_val;sp++) { + for (sp=symbols; sp->tok_val; sp++) { if (*sp->string == *unit) { token->type = BU_LEX_SYMBOL; token->t_key.value = sp->tok_val; @@ -266,7 +268,7 @@ } if (keywords) { register struct bu_lex_key *kp; - for (kp=keywords;kp->tok_val; kp++) { + for (kp=keywords; kp->tok_val; kp++) { if (BU_STR_EQUAL(kp->string, unit)) { token->type = BU_LEX_KEYWORD; token->t_key.value = kp->tok_val; Index: rb_extreme.c =================================================================== --- rb_extreme.c (revision 48946) +++ rb_extreme.c (working copy) @@ -54,7 +54,7 @@ RB_CKORDER(tree, order); child = (sense == SENSE_MIN) ? rb_left_child(root, order) : - rb_right_child(root, order); + rb_right_child(root, order); if (child == empty_node) break; root = child; @@ -105,13 +105,12 @@ empty_node = rb_null(tree); child = (sense == SENSE_MIN) ? rb_left_child(node, order) : - rb_right_child(node, order); + rb_right_child(node, order); if (child != empty_node) return _rb_extreme(child, order, 1 - sense, empty_node); parent = rb_parent(node, order); while ((parent != empty_node) && - (node == rb_child(parent, order, sense))) - { + (node == rb_child(parent, order, sense))) { node = parent; parent = rb_parent(parent, order); } Index: parallel.c =================================================================== --- parallel.c (revision 48946) +++ parallel.c (working copy) @@ -393,18 +393,18 @@ FILE *fp; char buf[128]; - fp = fopen (CPUINFO_FILE, "r"); + fp = fopen(CPUINFO_FILE, "r"); if (fp == NULL) { - perror (CPUINFO_FILE); + perror(CPUINFO_FILE); } else { ncpu = 0; while (bu_fgets(buf, 80, fp) != NULL) { - if (strncmp (buf, "processor", 9) == 0) { + if (strncmp(buf, "processor", 9) == 0) { ncpu++; } } - fclose (fp); + fclose(fp); } } # endif @@ -460,8 +460,7 @@ FILE *fp; if ((fp = fopen(PUBLIC_CPUS1, "rb")) != NULL - || (fp = fopen(PUBLIC_CPUS2, "rb")) != NULL) - { + || (fp = fopen(PUBLIC_CPUS2, "rb")) != NULL) { int ret; ret = fscanf(fp, "%d", &public_cpus); if (ret != 1) @@ -475,8 +474,7 @@ bu_file_delete(PUBLIC_CPUS1); bu_file_delete(PUBLIC_CPUS2); if ((fp = fopen(PUBLIC_CPUS1, "wb")) != NULL || - (fp = fopen(PUBLIC_CPUS2, "wb")) != NULL) - { + (fp = fopen(PUBLIC_CPUS2, "wb")) != NULL) { fprintf(fp, "%d\n", avail_cpus); bu_fchmod_stream(fp, 0666); fclose(fp); @@ -548,8 +546,7 @@ if (tbl[i]) { if (kill(tbl[i], 9)) { perror("parallel_kill_workers(): SIGKILL to child process"); - } - else { + } else { bu_log("parallel_kill_workers(): child pid %d killed\n", tbl[i]); } } @@ -799,7 +796,7 @@ # else 4*1024*1024 - 32*1024 # endif - ); + ); # endif if (new < 0) { perror("sproc"); @@ -838,8 +835,8 @@ /* XXX How to cope with this; can't back out work that was lost at this level. */ # ifdef IRIX if (WIFEXITED(pstat)) - bu_log ("Child terminated normally with status %d 0x%0x\n", - WEXITSTATUS(pstat)); + bu_log("Child terminated normally with status %d 0x%0x\n", + WEXITSTATUS(pstat)); if (WIFSIGNALED(pstat)) { bu_log("child terminated on signal %d %0x\n", WTERMSIG(pstat));