← Back to team overview

dulwich-users team mailing list archive

Re: make dulwich compile with mingw

 

On Tue, 2010-08-17 at 15:01 -0700, David Borowitz wrote:
> If we just want to test for mingw specifically rather than strnlen
> generally you may be able to do:
> 
> 
> #ifdef __MINGW32_VERSION
> #define MINGW
> #endif
> ...
> #ifdef MINGW
> size_t strnlen ...
> #endif
> 
> 
> (The __MINGW32_VERSION trick is based purely on googling rather than
> my own experience.)

Unfortunately the issue is that mingw is not the only system that
doesn't have strnlen. Some of the BSDs also don't provide it, and I can
imagine the same is true for some (all?) of the commercial Unixes.

Cheers,

Jelmer

> 
> On Tue, Aug 17, 2010 at 14:45, Jelmer Vernooij <jelmer@xxxxxxxxx>
> wrote:
>         On Tue, 2010-08-17 at 14:40 -0700, David Borowitz wrote:
>         > I'm not a huge fan of inlining this function as opposed to a
>         > conditionally-defined macro or header file. What if we want
>         to use
>         > strlen in other places?
>         
>         Me neither. The issue there though is that we'd have to add a
>         complex
>         test in setup.py to see if the system provides a strnlen()
>         implementation.
>         
>         If we end up with strnlen() in more places I think we should
>         revisit
>         this decision, and perhaps go the more complex route instead.
>         
>         Cheers,
>         
>         Jelmer
>         
>         
>         > On Tue, Aug 17, 2010 at 14:36, Jelmer Vernooij
>         <jelmer@xxxxxxxxx>
>         > wrote:
>         >
>         >         On Tue, 2010-08-17 at 23:30 +0200, Hans Kolek wrote:
>         >         > I've patched dulwich to compile with mingw. The
>         patch is
>         >         attached. As
>         >         > you can see I've just removed the strnlen call and
>         replaced
>         >         it with
>         >         > its implementation.
>         >
>         >         This looks alright, but please don't use
>         declarations after
>         >         statements,
>         >         as they break some compilers.
>         >
>         >         Cheers,
>         >
>         >         Jelmer
>         >
>         >
>         >         _______________________________________________
>         >         Mailing list: https://launchpad.net/~dulwich-users
>         >         Post to     : dulwich-users@xxxxxxxxxxxxxxxxxxx
>         >         Unsubscribe : https://launchpad.net/~dulwich-users
>         >         More help   : https://help.launchpad.net/ListHelp
>         >
>         >
>         
>         
> 
> 

Attachment: signature.asc
Description: This is a digitally signed message part


References