On Fri, Sep 2, 2011 at 8:55 AM, Sunil Nimmagadda <su...@sunilnimmagadda.com> wrote: > This diff adds tags support to Mg. I am NOT an emacs user so if this > combination is a bit odd then please excuse. It parses the tags file > generated by ctags(1) and maintains a tree. M-. on first character of > a word jumps to it's definition and M-* jumps back to previous location.
I'd love to have ctags support in mg. > -# $OpenBSD: Makefile,v 1.24 2011/02/02 05:21:36 lum Exp $ > +# $OpenBSD: Makefile,v 1.23 2011/01/18 17:35:42 lum Exp $ Can you recreate the diff without these changes? > +/* > + * Helper function to append a character to a C string. > + */ > +static void > +append(char *s, int c) > +{ > + size_t l = strlen(s); > + s[l++] = c; > + s[l] = '\0'; > +} I don't like this. I don't see any evidence that the length of s here will be bounded, and it appears to be used to fill a local fixed-sized buffer. Having to call strlen() for each character append is suboptimal too. Means building up the string takes O(n^2) time. (I haven't had a chance to look at the diff in depth yet, but this issue stood out to me.)