1. 11

  2. 13

    Man, if things like no globals and indented are your gold standard… Why do I get the sense this is a fluff post to drive traffic?

    1. 3

      Reminds me of ye olde maxim, debug code, not comments.

      The function comment is wrong.

      I would also have appreciated a comment as to why it elected to alloc and memcpy instead of realloc. I’m sure there is a reason, but a comment would have been nice.

      Again, on the surface it’s a memory leak, he overwrites pIdx->azColl without stashing it elsewhere or freeing it.

      ie. There are some side effects going on and context going on that is not obvious from this code.

      That is what comments are for.

      Possibly you could extract some of that code into a named function that would make the intent obvious, but as is, it is not obvious code at all.