On 11/10/2015 07:03 PM, Donald Sharp wrote: > I'm not a big fan of repeatedly calling unix_hostname().
Right. At a quick glance I thought that unix_hostname() would cache the hostname, but it only uses static storage scope so that the returned pointer remains valid. I will change that. > Additionally in one case you use sizeof(lsp->tlv_data.hostname->name) and > in other cases you test against 255 and then set it to that. > > Why not use a #define and clear all that up? I used sizeof in the strncpy since it makes code review easier. Since it references the variable that is the target of the operation, it is obvious that the passed length is correct. If I used a define, I would have to look up the definition of the hostname field and the definition of the #define to verify that the code is indeed correct. I would prefer to leave it like it is, but if you strongly prefer it not to be written this way, I can change it. The 255 is the maximum allowable size for the hostname TLV. I could maybe add a #define MAX_TLV_SIZE or MAX_HOSTNAME_TLV_SIZE with 255 as value, and test against that? -Christian _______________________________________________ Quagga-dev mailing list [email protected] https://lists.quagga.net/mailman/listinfo/quagga-dev
