mirror of
https://github.com/ascii-boxes/boxes.git
synced 2024-12-04 22:11:07 +01:00
Rename global variable anz_designs to num_designs #78
This commit is contained in:
parent
9d17203f50
commit
4d0dbcd59b
@ -44,7 +44,7 @@
|
||||
+--------------------------------------------------------------------------*/
|
||||
|
||||
design_t *designs = NULL; /* available box designs */
|
||||
int anz_designs = 0; /* number of designs after parsing TODO rename to num_designs */
|
||||
int num_designs = 0; /* number of designs after parsing */
|
||||
|
||||
opt_t opt; /* command line options */
|
||||
|
||||
@ -209,7 +209,7 @@ static int query_by_tag()
|
||||
if (list == NULL) {
|
||||
return 1;
|
||||
}
|
||||
for (int i = 0; i < anz_designs; ++i) {
|
||||
for (int i = 0; i < num_designs; ++i) {
|
||||
if (filter_by_tag(list[i]->tags)) {
|
||||
fprintf(opt.outfile, "%s%s", list[i]->name, opt.eol);
|
||||
for (size_t aidx = 0; list[i]->aliases[aidx] != NULL; ++aidx) {
|
||||
@ -284,14 +284,14 @@ int main(int argc, char *argv[])
|
||||
if (designs == NULL) {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
anz_designs = (int) r_num_designs;
|
||||
num_designs = (int) r_num_designs;
|
||||
}
|
||||
else {
|
||||
rc = build_design(&designs, opt.cld);
|
||||
if (rc) {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
anz_designs = 1;
|
||||
num_designs = 1;
|
||||
}
|
||||
BFREE (opt.design);
|
||||
opt.design = designs;
|
||||
|
@ -101,7 +101,7 @@ typedef struct {
|
||||
} design_t;
|
||||
|
||||
extern design_t *designs;
|
||||
extern int anz_designs;
|
||||
extern int num_designs;
|
||||
|
||||
|
||||
typedef struct { /* Command line options: */
|
||||
|
@ -110,12 +110,12 @@ static int style_sort(const void *p1, const void *p2)
|
||||
|
||||
design_t **sort_designs_by_name()
|
||||
{
|
||||
design_t **result = (design_t **) malloc(anz_designs * sizeof(design_t *));
|
||||
design_t **result = (design_t **) malloc(num_designs * sizeof(design_t *));
|
||||
if (result != NULL) {
|
||||
for (int i = 0; i < anz_designs; ++i) {
|
||||
for (int i = 0; i < num_designs; ++i) {
|
||||
result[i] = &(designs[i]);
|
||||
}
|
||||
qsort(result, anz_designs, sizeof(design_t *), style_sort);
|
||||
qsort(result, num_designs, sizeof(design_t *), style_sort);
|
||||
}
|
||||
else {
|
||||
perror(PROJECT);
|
||||
@ -360,7 +360,7 @@ int list_designs()
|
||||
}
|
||||
print_design_list_header();
|
||||
|
||||
for (int i = 0; i < anz_designs; ++i) {
|
||||
for (int i = 0; i < num_designs; ++i) {
|
||||
char *all_names = names(list[i]);
|
||||
if (list[i]->author && list[i]->designer && strcmp(list[i]->author, list[i]->designer) != 0) {
|
||||
fprintf(opt.outfile, "%s%s%s, coded by %s:%s%s%s%s%s", all_names, opt.eol,
|
||||
|
@ -76,12 +76,12 @@ static int open_yy_config_file(pass_to_bison *bison_args)
|
||||
void print_design_list_header()
|
||||
{
|
||||
char buf[42];
|
||||
sprintf(buf, "%d", anz_designs);
|
||||
sprintf(buf, "%d", num_designs);
|
||||
|
||||
fprintf(opt.outfile, "%d Available Style%s", anz_designs, anz_designs == 1 ? "" : "s");
|
||||
fprintf(opt.outfile, "%d Available Style%s", num_designs, num_designs == 1 ? "" : "s");
|
||||
if (num_parent_configs > 0) {
|
||||
fprintf(opt.outfile, ":%s", opt.eol);
|
||||
fprintf(opt.outfile, "-----------------%s", anz_designs == 1 ? "" : "-");
|
||||
fprintf(opt.outfile, "-----------------%s", num_designs == 1 ? "" : "-");
|
||||
for (int i = strlen(buf); i > 0; --i) {
|
||||
fprintf(opt.outfile, "-");
|
||||
}
|
||||
@ -94,7 +94,7 @@ void print_design_list_header()
|
||||
}
|
||||
else {
|
||||
fprintf(opt.outfile, " in \"%s\":%s", first_config_file, opt.eol);
|
||||
fprintf(opt.outfile, "-----------------------%s", anz_designs == 1 ? "" : "-");
|
||||
fprintf(opt.outfile, "-----------------------%s", num_designs == 1 ? "" : "-");
|
||||
for (int i = strlen(first_config_file) + strlen(buf); i > 0; --i) {
|
||||
fprintf(opt.outfile, "-");
|
||||
}
|
||||
|
@ -531,7 +531,7 @@ static design_t *detect_design()
|
||||
size_t a;
|
||||
int empty[NUM_SIDES];
|
||||
|
||||
for (dcnt = 0; dcnt < anz_designs; ++dcnt, ++d) {
|
||||
for (dcnt = 0; dcnt < num_designs; ++dcnt, ++d) {
|
||||
#ifdef DEBUG
|
||||
fprintf (stderr, "CONSIDERING DESIGN ---- \"%s\" ---------------\n",
|
||||
d->name);
|
||||
|
Loading…
Reference in New Issue
Block a user