|
From: <kin...@us...> - 2024-07-17 17:48:08
|
Revision: 7214
http://sourceforge.net/p/teem/code/7214
Author: kindlmann
Date: 2024-07-17 17:48:07 +0000 (Wed, 17 Jul 2024)
Log Message:
-----------
fixing uses of AIR_STRLEN_x plus clang-format
Modified Paths:
--------------
teem/trunk/Testing/air/amath.c
teem/trunk/Testing/air/pptest.c
teem/trunk/Testing/air/strtok.c
Modified: teem/trunk/Testing/air/amath.c
===================================================================
--- teem/trunk/Testing/air/amath.c 2024-07-17 17:45:47 UTC (rev 7213)
+++ teem/trunk/Testing/air/amath.c 2024-07-17 17:48:07 UTC (rev 7214)
@@ -21,7 +21,6 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
#include "teem/air.h"
/*
@@ -31,7 +30,7 @@
int
main(int argc, const char *argv[]) {
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
airArray *mop;
AIR_UNUSED(argc);
@@ -43,15 +42,16 @@
size_t ee = 1;
do {
if (l2 != (ret = airLog2(ee))) {
- fprintf(stderr, "airLog2(%s) = %d != %d\n",
- airSprintSize_t(stmp, ee), ret, l2);
- airMopError(mop); return 1;
+ fprintf(stderr, "airLog2(%s) = %d != %d\n", airSprintSize_t(stmp, ee), ret, l2);
+ airMopError(mop);
+ return 1;
}
if (ee > 1) {
- if (-1 != (ret = airLog2(ee+1))) {
- fprintf(stderr, "airLog2(%s) = %d != -1\n",
- airSprintSize_t(stmp, ee+1), ret);
- airMopError(mop); return 1;
+ if (-1 != (ret = airLog2(ee + 1))) {
+ fprintf(stderr, "airLog2(%s) = %d != -1\n", airSprintSize_t(stmp, ee + 1),
+ ret);
+ airMopError(mop);
+ return 1;
}
}
l2 += 1;
@@ -66,21 +66,21 @@
rng = airRandMTStateNew(4242);
airMopAdd(mop, rng, (airMopper)airRandMTStateNix, airMopAlways);
error = 0;
- for (ti=0; ti<testnum; ti++) {
+ for (ti = 0; ti < testnum; ti++) {
double dif;
- airNormalRand_r(aa+0, aa+1, rng);
- for (pi=0; pi<2; pi++) {
+ airNormalRand_r(aa + 0, aa + 1, rng);
+ for (pi = 0; pi < 2; pi++) {
aa[pi] *= 10000;
uu = airCbrt(aa[pi]);
- dif = fabs(aa[pi] - uu*uu*uu);
- error += (dif/aa[pi])*dif;
+ dif = fabs(aa[pi] - uu * uu * uu);
+ error += (dif / aa[pi]) * dif;
}
}
error /= testnum;
if (error > eps) {
- fprintf(stderr, "average cbrt error was %.17g > eps %0.17g\n",
- error, eps);
- airMopError(mop); return 1;
+ fprintf(stderr, "average cbrt error was %.17g > eps %0.17g\n", error, eps);
+ airMopError(mop);
+ return 1;
} else {
fprintf(stderr, "average cbrt error = %.17g\n", error);
}
@@ -88,6 +88,3 @@
exit(0);
}
-
-
-
Modified: teem/trunk/Testing/air/pptest.c
===================================================================
--- teem/trunk/Testing/air/pptest.c 2024-07-17 17:45:47 UTC (rev 7213)
+++ teem/trunk/Testing/air/pptest.c 2024-07-17 17:48:07 UTC (rev 7214)
@@ -21,7 +21,6 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
#include "teem/air.h"
/*
@@ -35,7 +34,7 @@
const char *me;
size_t sz;
ptrdiff_t pd;
- char stmp[AIR_STRLEN_SMALL];
+ char stmp[AIR_STRLEN_SMALL + 1];
AIR_UNUSED(argc);
me = argv[0];
@@ -56,6 +55,3 @@
exit(0);
}
-
-
-
Modified: teem/trunk/Testing/air/strtok.c
===================================================================
--- teem/trunk/Testing/air/strtok.c 2024-07-17 17:45:47 UTC (rev 7213)
+++ teem/trunk/Testing/air/strtok.c 2024-07-17 17:48:07 UTC (rev 7214)
@@ -21,7 +21,6 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
#include "teem/air.h"
/*
@@ -39,27 +38,24 @@
main(int argc, const char *argv[]) {
airArray *mop;
const char *me;
- const char *word[] = {
- "There's", "a", "certain", "slant", "of", "light",
- "On", "winter", "afternoons",
- "That", "oppresses,", "like", "the", "weight",
- "Of", "cathedral", "tunes.",
- "Heavenly", "hurt", "it", "gives", "us;",
- "We", "can", "find", "no", "scar,",
- "But", "internal", "difference",
- "Where", "the", "meanings", "are.",
- "None", "may", "teach", "it", "anything,",
- "'T", "is", "the", "seal,", "despair,",
- "An", "imperial", "affliction",
- "Sent", "us", "of", "the", "air.",
- "When", "it", "comes,", "the", "landscape", "listens,",
- "Shadows", "hold", "their", "breath;",
- "When", "it", "goes,", "'t", "is", "like", "the", "distance",
- "On", "the", "look", "of", "death.", ""};
+ const char *word[]
+ = {"There's", "a", "certain", "slant", "of", "light",
+ "On", "winter", "afternoons", "That", "oppresses,", "like",
+ "the", "weight", "Of", "cathedral", "tunes.", "Heavenly",
+ "hurt", "it", "gives", "us;", "We", "can",
+ "find", "no", "scar,", "But", "internal", "difference",
+ "Where", "the", "meanings", "are.", "None", "may",
+ "teach", "it", "anything,", "'T", "is", "the",
+ "seal,", "despair,", "An", "imperial", "affliction", "Sent",
+ "us", "of", "the", "air.", "When", "it",
+ "comes,", "the", "landscape", "listens,", "Shadows", "hold",
+ "their", "breath;", "When", "it", "goes,", "'t",
+ "is", "like", "the", "distance", "On", "the",
+ "look", "of", "death.", ""};
const char *sep = " \t\n_", *ww;
unsigned int wi, sepLen, lineLen, wordNum;
airArray *lineArr;
- char wordsp[AIR_STRLEN_MED], *line, *last=NULL;
+ char wordsp[AIR_STRLEN_MED + 1], *line, *last = NULL;
AIR_UNUSED(argc);
me = argv[0];
@@ -66,7 +62,7 @@
sepLen = AIR_CAST(unsigned int, airStrlen(sep));
mop = airMopNew();
- lineArr = airArrayNew((void**)(&line), &lineLen, sizeof(char), INCR);
+ lineArr = airArrayNew((void **)(&line), &lineLen, sizeof(char), INCR);
airMopAdd(mop, lineArr, (airMopper)airArrayNuke, airMopAlways);
/* initialize line with "" */
@@ -74,7 +70,7 @@
strcpy(line, "");
/* add words and separators onto line */
- for (wi=0; airStrlen(word[wi]); wi++) {
+ for (wi = 0; airStrlen(word[wi]); wi++) {
sprintf(wordsp, "%s%c", word[wi], sep[AIR_MOD(wi, sepLen)]);
airArrayLenIncr(lineArr, AIR_CAST(int, airStrlen(wordsp)));
strcat(line, wordsp);
@@ -81,7 +77,7 @@
}
/* lose last sep char */
- line[strlen(line)-1] = '\0';
+ line[strlen(line) - 1] = '\0';
/* start tokenizing and comparing */
wordNum = airStrntok(line, sep);
@@ -91,12 +87,9 @@
return 1;
}
wi = 0;
- for (ww = airStrtok(line, sep, &last);
- ww;
- ww = airStrtok(NULL, sep, &last)) {
+ for (ww = airStrtok(line, sep, &last); ww; ww = airStrtok(NULL, sep, &last)) {
if (strcmp(word[wi], ww)) {
- fprintf(stderr, "%s: word[%u] |%s| != parsed |%s|\n",
- me, wi, word[wi], ww);
+ fprintf(stderr, "%s: word[%u] |%s| != parsed |%s|\n", me, wi, word[wi], ww);
airMopError(mop);
exit(1);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|