Skip to content
  • Thomas Haller's avatar
    all/trivial: rename NM_UTILS_LOOKUP_STR() to have "_A" suffix · 617bdbd8
    Thomas Haller authored
    NM_UTILS_LOOKUP_STR() uses alloca(). Partly to avoid the overhead of
    malloc(), but more important because it's convenient to use. It does
    not require to declare a varible to manage the lifetime of the heap
    allocation.
    
    It's quite safe, because the stack allocation is of a fixed size of only
    a few bytes. Overall, I think the convenience that we get (resulting in
    simpler code) outweighs the danger of stack allocation in this case. It's
    still worth it.
    However, as it uses alloca(), it still must not be used inside a (unbound)
    loop and it is obviously a macro.
    
    Rename the macros to have a _A() suffix. This should make the
    peculiarities more apparent.
    617bdbd8