lkml.org 
[lkml]   [2005]   [Feb]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 2/8] lib/sort: Replace qsort in XFS
From
Date
On Tue, 2005-02-01 at 14:22 -0800, Randy.Dunlap wrote:
> Chris Wedgwood wrote:
> > On Mon, Jan 31, 2005 at 01:34:59AM -0600, Matt Mackall wrote:
> >
> >
> >>+#define qsort xfs_sort
> >>+static inline void xfs_sort(void *a, size_t n, size_t s,
> >>+ int (*cmp)(const void *,const void *))
> >>+{
> >>+ sort(a, n, s, cmp, 0);
> >>+}
> >>+
> >
> >
> > why not just:
> >
> > #define qsort(a, n, s, cmp) sort(a, n, s, cmp, NULL)
> >
> >
> >
> > On Mon, Jan 31, 2005 at 01:35:00AM -0600, Matt Mackall wrote:
> >
> >
> >>Switch NFS ACLs to lib/sort
> >
> >
> >>+ sort(acl->a_entries, acl->a_count, sizeof(struct posix_acl_entry),
> >>+ cmp_acl_entry, 0);
> >
> >
> > There was a thread about stlye and I though the concensurs for null
> > pointers weas to use NULL and not 0?
>
> Yes, otherwise sparse complains... and maybe Linus :)

And you get in the habit of using 0 instead of NULL and before you know
it you've used it in a variable argument list for a GTK library call on
an AMD64 system and corrupted the stack. :-)

(The compiler can't convert 0 to a pointer if it doesn't know that it's
supposed to be one. Variable argument lists are evil that way.)

--
Zan Lynx <zlynx@acm.org>
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2005-03-22 14:10    [from the cache]
©2003-2011 Jasper Spaans