Mercurial > hg > dmlib
comparison tools/fanalyze.c @ 2269:f350c7514785
Cleanups.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 17 Jun 2019 10:27:05 +0300 |
parents | f2ff364065eb |
children | 0f0218dcccf8 |
comparison
equal
deleted
inserted
replaced
2268:f2ff364065eb | 2269:f350c7514785 |
---|---|
8 #include "dmtool.h" | 8 #include "dmtool.h" |
9 #include "dmlib.h" | 9 #include "dmlib.h" |
10 #include "dmargs.h" | 10 #include "dmargs.h" |
11 #include "dmfile.h" | 11 #include "dmfile.h" |
12 | 12 |
13 #define SET_MAX_FILES 64 | 13 #define SET_MAX_FILES 64 |
14 #define SET_MAX_ELEMS 256 | 14 #define SET_MAX_ELEMS 256 |
15 #define SET_MAX_VALUES 64 | |
16 #define SET_MAX_GREPLIST 64 | |
17 #define SET_MAX_VARIANTS 4 | 15 #define SET_MAX_VARIANTS 4 |
18 | 16 |
19 #define SET_MAX_SEQUENCES 1024 | 17 #define SET_MAX_GREP_VALUES 64 |
20 #define SET_MAX_PLACES 1024 | 18 #define SET_MAX_GREP_LIST 64 |
19 | |
20 #define SET_MAX_SEQUENCES 1024 | |
21 #define SET_MAX_PLACES 1024 | |
21 | 22 |
22 | 23 |
23 /* Typedefs | 24 /* Typedefs |
24 */ | 25 */ |
25 typedef struct | 26 typedef struct |
95 typedef struct | 96 typedef struct |
96 { | 97 { |
97 int type; | 98 int type; |
98 int disp; | 99 int disp; |
99 int nvalues; | 100 int nvalues; |
100 Uint32 values[SET_MAX_GREPLIST]; | 101 Uint32 values[SET_MAX_GREP_LIST]; |
101 BOOL vwildcards[SET_MAX_GREPLIST]; | 102 BOOL vwildcards[SET_MAX_GREP_LIST]; |
102 } DMGrepValue; | 103 } DMGrepValue; |
103 | 104 |
104 | 105 |
105 typedef struct | 106 typedef struct |
106 { | 107 { |
149 int setMode = FA_ANALYZE; | 150 int setMode = FA_ANALYZE; |
150 int nsrcFiles = 0; // Number of source files | 151 int nsrcFiles = 0; // Number of source files |
151 DMSourceFile srcFiles[SET_MAX_FILES]; // Source file names | 152 DMSourceFile srcFiles[SET_MAX_FILES]; // Source file names |
152 DMStats totalStats; | 153 DMStats totalStats; |
153 int nsetGrepValues = 0; | 154 int nsetGrepValues = 0; |
154 DMGrepValue setGrepValues[SET_MAX_VALUES]; | 155 DMGrepValue setGrepValues[SET_MAX_GREP_VALUES]; |
155 size_t optMinMatchLen = 8; | 156 size_t optMinMatchLen = 8; |
156 | 157 |
157 DMMatchSeq dmSequences[SET_MAX_SEQUENCES]; | 158 DMMatchSeq dmSequences[SET_MAX_SEQUENCES]; |
158 int ndmSequences = 0; | 159 int ndmSequences = 0; |
159 | 160 |
362 | 363 |
363 // Get list of values | 364 // Get list of values |
364 char *vtmp = vstr; | 365 char *vtmp = vstr; |
365 do | 366 do |
366 { | 367 { |
367 if (val.nvalues >= SET_MAX_GREPLIST) | 368 if (val.nvalues >= SET_MAX_GREP_LIST) |
368 { | 369 { |
369 ret = dmError(DMERR_BOUNDS, | 370 ret = dmError(DMERR_BOUNDS, |
370 "Too many greplist values specified '%s'.\n", | 371 "Too many greplist values specified '%s'.\n", |
371 vstr); | 372 vstr); |
372 goto out; | 373 goto out; |
450 { | 451 { |
451 if (val.type < 0) | 452 if (val.type < 0) |
452 val.type = DMGV_UINT8; | 453 val.type = DMGV_UINT8; |
453 } | 454 } |
454 | 455 |
455 if (nsetGrepValues < SET_MAX_VALUES) | 456 if (nsetGrepValues < SET_MAX_GREP_VALUES) |
456 { | 457 { |
457 DMGrepValue *node = &setGrepValues[nsetGrepValues++]; | 458 DMGrepValue *node = &setGrepValues[nsetGrepValues++]; |
458 memcpy(node, &val, sizeof(val)); | 459 memcpy(node, &val, sizeof(val)); |
459 | 460 |
460 if (mode == FA_GREP) | 461 if (mode == FA_GREP) |
467 } | 468 } |
468 else | 469 else |
469 { | 470 { |
470 ret = dmError(DMERR_BOUNDS, | 471 ret = dmError(DMERR_BOUNDS, |
471 "Too many values specified (max %d).", | 472 "Too many values specified (max %d).", |
472 SET_MAX_VALUES); | 473 SET_MAX_GREP_VALUES); |
473 } | 474 } |
474 | 475 |
475 out: | 476 out: |
476 dmFree(vspec); | 477 dmFree(vspec); |
477 dmFree(vstr); | 478 dmFree(vstr); |