Re: [Vala] How to wrap select(2)'s fd_set?



* Michael 'Mickey' Lauer wrote, On 05/02/09 15:39:
Am Thursday 05 February 2009 15:03:57 schrieb Sam Liddicott:
  
Ok, I now found out:

FD_ZERO is defined as __FD_ZERO which in turn is defined as:

/* We don't use `memset' because this would require a prototype and
  the array isn't too big.  */
#define __FD_ZERO(s) \
 do { \
   unsigned int __i; \
   fd_set *__arr = (s); \
   for (__i = 0; __i < sizeof (fd_set) / sizeof (__fd_mask); ++__i) \
     __FDS_BITS (__arr)[__i] = 0; \
 } while (0)

The valac-generated part

        
readfds = (FD_ZERO (&_tmp0), _tmp0);
          
is a syntax error then.

Anything we can do about that or just give in and leaving FdSet a full
class?
        
use memset ?
    

Heh, right. Will you try to get the patch into the respective c libraries?
  

I thought we were talking about vapi files. Something like
[Compact]
     public class FdSet
     {   
         [CCode (cheader_filename = "string.h")]
         public void zero () {
           memset(this, 0, sizeof(this));
         }
But I suppose you could also call FD_ZERO from the body too...

Sam


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]