On Thu, Nov 6, 2014 at 4:33 AM, Calvin Morrison <mutanttur...@gmail.com> wrote: > On 31 October 2014 17:23, Calvin Morrison <mutanttur...@gmail.com> wrote: > > A rewrite to C has been done [0] Please check it out the code is > pretty reeky and I want some advice on how to make it suck less. I was > avoiding doing extra mallocs so there's a lot of ugly printfs, plus > there's still always an extra tabulator on the end field. > > Also, on an related note, someone dropeed a tiling wm in Rust:[1]
Sorry for the previous top post. I also want to add: interfaces = realloc(interfaces, sizeof(struct iface) * (no_iface + 1)); leaks memory normally (not a real problem in your case because you exit). it should be: if(!(tmp = realloc(interfaces, ...)) { free(interfaces); interfaces = NULL; exit(...); } interfaces = tmp; - Rename volatile bool q = false; to "isrunning". - Use the safer strlcpy or snprintf instead of strcpy(). - Print usage in the default case of the argv parsing and remove 'h' and '?'. Kind regards, Hiltjo