Well, a few trivial tasks could probably be automated. What comes
first to my mind is the removal of the common includes for the non plan
9 headers/libs, namely string.h, stdlib.h, math.h, and stdio.h. I know
this last one is in plan 9 but most of the time the plan 9 one was not
the one needed as the function used were in plan 9's libc, not in stdio.
I did not have to add libc.h and u.h that often, so it wouldn't have
been worth being automated imho.

Then I guess replacing the alloca() calls with malloc() could be done
automatically but one still has to do some carefull searching to place
the free()s, so I'm not sure one would gain much time with this.

As with exit(), it can be replaced automatically with exits() but you
still have to figure out what message you want in your exits().

Honestly, it took me more time to figure out what was wrong and how to
fix it, than to actually do it. Once you have some sort of workflow set
up in your mind, a few Edit lines in a guide file make the repetitive
tasks go much faster. For example, since my sam-foo is weak, it took
me a while to devise that: 'Edit line1,line2x/.*\n/ g/return/p', which
would give me how many return there are in the function I am looking at,
hence helping me not to miss any of the free() to place (without having
to go through all the code).

Cheers,
Mathieu
--- Begin Message ---
>From what you learned, are there some nice general scripts that could
be used to automate some of this for the next hunk of gnu-like code
that comes along?

Thanks for the port ...

ron

--- End Message ---

Reply via email to