Runs together identifiers across linebreaks
Input: `#include <stdio.h>
int main(int argc, char **argv) { printf("hello world\n"); } `
Output:
#include<stdio.h> intmain(int argc,char**argv){printf("hello world\n");}
Note "intmain". Placing the return type of a function on the line before is often useful, since it lets you search for the definition of the function by searching for it at the beginning of a line.
Yes, cminify is quite buggy, but search for the definition of a function could be attained with a regex like ^(?:static)\s+(int|bool|char|...)\s+\**\s+[a-zA-Z0-9_]+\s+\(... etc
Sure, but how easy is that to type in on a command line or in an editor search when you're trying to find where in all the dozens of files and thousands of lines you defined the function? The point is that some people (incl. me) do like to split the return-type from the function, for this reason (whether or not it's important for everyone), so it isn't such a bizarre and unheard-of formatting, and cminify is liable to make it into a syntax error. I was tinkering with a patch for this, involving joining up lines with spaces instead of null-strings (which, yes, got me a lot more spaces than needed) and also not storing null-strings for removed lines, but it wasn't really right. I guess I should do it properly and submit a PR.
(I use a regex like that in my editors everyday, but I can understand not wanting to ;)
As you can tell, this program isn't really actively maintained anymore, and I would maintain a fork except that --
from trying it myself I will say, unless you want to spend a week completely rewriting this library, it's very hard or impossible to fix these kinds of problems due to the very fundamental, wrong assertions that cminify makes about the actual limits of the C grammar.
And if one were to mostly re-write cminify, one might as well write a replacement entirely, and fix the other glaring bugs...