[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: timeval in ldapext-ldap-c-api-01



Kurt D. Zeilenga writes:
> I believe the spec should state the this structure
> must be externally defined by the application developer
> by either including the appropriate system header or
> defining it herself.

Please, no!  Sound complaints against <sys/time.h> & co, but wrong
solution.  We shouldn't force application developers who want protable
programs, to write #ifdef spaghetti to find timeval.  Leave that to API
implementors, they have to figure out portability issues anyway.

> Because some implementations can not safely declare
> struct timeval, all implementions SHOULD NOT.

Right.
The solutions I can think of, are:

- use `double' instead of `struct timeval', and rename the current
  functions that now use timeval.  Keep at least the ldap_search_st and
  ldap_result as deprecated functions, since they were in rfc1823.
  Maybe only declare them if the user has #defined some symbol before
  `#include <ldap.h>'.

- or have <ldap.h> run the proper #ifdef spaghetti to find timeval,
  unless the user has #defined LDAP_HAS_TIMEVAL - then trust the user to
  have #included the proper headers.  Or maybe #ifdef LDAP_TIMEVAL_t
  where ldap.h will use LDAP_TIMEVAL_t instead of struct timeval in the
  prototypes.

-- 
Hallvard