Re: [dev] fsbm

From: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Thu, 6 Nov 2014 17:53:18 +0100

On Thu, Nov 6, 2014 at 4:33 AM, Calvin Morrison <mutantturkey_AT_gmail.com> wrote:
> On 31 October 2014 17:23, Calvin Morrison <mutantturkey_AT_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
Received on Thu Nov 06 2014 - 17:53:18 CET

This archive was generated by hypermail 2.3.0 : Thu Nov 06 2014 - 18:00:13 CET