Re: fts_open() (was: Re: Patch to restore WARNS feature)

2001-06-13 Thread Bruce Evans

On Wed, 13 Jun 2001, Ruslan Ermilov wrote:

 Should I commit the attached patch then?

I don't like changing the documented interface of fts_open() but all the
alternatives that I can think of aren't appealing:
1. Provide a glue function that converts what qsort expects to the
   documented interface.  This seems to require saving sp-fts_compare
   in a global variable so that it can be accessed in the glue function.
2. Provide an alternative to qsort() that takes an fts-compatible
   comparison function.
3. Provide an alternative to qsort() that takes an comparison function
   that takes an additional function pointer arg (use this arg to avoid
   the global in (1)).

Bruce


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: fts_open() (was: Re: Patch to restore WARNS feature)

2001-06-13 Thread Garrett Wollman

On Wed, 13 Jun 2001 23:28:29 +1000 (EST), Bruce Evans [EMAIL PROTECTED] said:

 3. Provide an alternative to qsort() that takes an comparison function
that takes an additional function pointer arg (use this arg to avoid
the global in (1)).

Actually, doing this would solve a number of similar problems, and it
doesn't look to be too difficult to do.  I would make the additional
argument a `void *'; fts's comparison trampoline function could use
this as a `FTS *' to look up the comparison function.  (I think this
is more general than passing any kind of function pointer.)

-GAWollman


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: fts_open() (was: Re: Patch to restore WARNS feature)

2001-06-13 Thread Ruslan Ermilov

On Wed, Jun 13, 2001 at 11:16:57AM -0400, Garrett Wollman wrote:
 On Wed, 13 Jun 2001 23:28:29 +1000 (EST), Bruce Evans [EMAIL PROTECTED] said:
 
  3. Provide an alternative to qsort() that takes an comparison function
 that takes an additional function pointer arg (use this arg to avoid
 the global in (1)).
 
 Actually, doing this would solve a number of similar problems, and it
 doesn't look to be too difficult to do.  I would make the additional
 argument a `void *'; fts's comparison trampoline function could use
 this as a `FTS *' to look up the comparison function.  (I think this
 is more general than passing any kind of function pointer.)
 
How should we call this function?
(I'll implement this tomorrow.)


-- 
Ruslan Ermilov  Oracle Developer/DBA,
[EMAIL PROTECTED]   Sunbay Software AG,
[EMAIL PROTECTED]  FreeBSD committer,
+380.652.512.251Simferopol, Ukraine

http://www.FreeBSD.org  The Power To Serve
http://www.oracle.com   Enabling The Information Age

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: fts_open() (was: Re: Patch to restore WARNS feature)

2001-06-13 Thread Garrett Wollman

On Wed, 13 Jun 2001 11:55:30 -0400, Alfred Perlstein [EMAIL PROTECTED] said:

 Why not do something like the rpc code does?  Check if threaded, if
 so cons up a thread specific key otherwise use a global.

The Standard does not appear to say whether qsort() is reentrant, but
I believe that it ought to be.  fts() was clearly intended to be
reentrant.  (I don't know what good it would do, but let's not make
things worse than they already are, hey?)

-GAWollman


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: fts_open() (was: Re: Patch to restore WARNS feature)

2001-06-13 Thread Bruce Evans

On Wed, 13 Jun 2001, Garrett Wollman wrote:

 On Wed, 13 Jun 2001 23:28:29 +1000 (EST), Bruce Evans [EMAIL PROTECTED] said:
 
  3. Provide an alternative to qsort() that takes an comparison function
 that takes an additional function pointer arg (use this arg to avoid
 the global in (1)).
 
 Actually, doing this would solve a number of similar problems, and it
 doesn't look to be too difficult to do.  I would make the additional
 argument a `void *'; fts's comparison trampoline function could use
 this as a `FTS *' to look up the comparison function.  (I think this
 is more general than passing any kind of function pointer.)

Good idea.

Bruce


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message