Messages in this thread | | | From | Denis Vlasenko <> | Subject | Re: [RFC] Some useless cleanup | Date | Thu, 9 May 2002 13:09:04 -0200 |
| |
On 9 May 2002 08:28, Paul P Komkoff Jr wrote: > Look at this very funny cleanup changeset for 2.4 > avaliable at linux-stingr.bkbits.net/comm > > For those who don't have bk I including it here below. > > Please give your comments. Maybe it is completely useless and anything > should stay as before, or maybe it is somewhat useful and this abstraction > will decrease possibility of bugs such as akpm worked around in 8139too
Well, it isn't bad, but what's the point in multiple set_xxxxxx(char *dst, char *src) functions?
Maybe it makes more sense to have a generic macro which copies string into char[N] buffer, avoiding overflow.
Actually, there is similar code in your mail: > - strncpy (current->comm, dev->name, sizeof(current->comm) - 1); > - current->comm[sizeof(current->comm) - 1] = '\0'; > + set_current_title(dev->name);
A macro:
#define STRNCPY(dst,src) \ do { \ /* todo: put clever check that dst is char[] here */ \ strncpy((dst), (src), sizeof(dst)-1); \ dst[sizeof(dst)-1] = '\0'; \ } while(0)
-- vda - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |