lkml.org 
[lkml]   [2002]   [May]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [RFC] Some useless cleanup
Date
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/

\
 
 \ /
  Last update: 2005-03-22 13:25    [W:0.078 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site