When the separate command functions were merged everything was combined
into one relatively complex printf call. Profiling on GNU/Linux showed
a surprising amount of time spent printing.
Restructure the code to just print the two cases separately. The result
is easier to understand, compiles to less code, and is slightly faster,
so what's not to like?
/*
* Main command implementation routines for cdecl99.
/*
* Main command implementation routines for cdecl99.
- * Copyright © 2011-2012, 2020-2021, 2023 Nick Bowler
+ * Copyright © 2011-2012, 2020-2021, 2023-2024 Nick Bowler
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
for (i = parse; i; i = i->next) {
const char *str;
for (i = parse; i; i = i->next) {
const char *str;
if (!(str = do_render(i, output_mode)))
goto out;
if (!(str = do_render(i, output_mode)))
goto out;
*/
if (output_mode == OUTPUT_C && i->next) {
i->next->specifiers = NULL;
*/
if (output_mode == OUTPUT_C && i->next) {
i->next->specifiers = NULL;
+ printf("%s, ", str);
+ } else {
+ puts(str);
-
- printf(", %s%s" + 2*!!i->specifiers, str, "\n" + no_nl);