Re: ORBit not compiling: can't find 'strndup'
- From: Stuart Parmenter <pavlov innerx net>
- To: davidk lysator liu se (David Kågedal ),gnome-list gnome org
- Subject: Re: ORBit not compiling: can't find 'strndup'
- Date: Wed, 19 Aug 1998 09:55:46 -0400
This issue has been fixed as of yesterday. You will need to update glib,
as it now contains g_strndup. ORBit uses this function now.
At 03:47 PM 8/19/98 +0200, David Kågedal wrote:
>"James V. Di Toro III" <karrde@gats.hampton.va.us> writes:
>
>> Hi ther, this is my first time around trying to set up GNOME, and
>> I decided to do it by CVS. I've got to the point where I'm compiling
>> ORBit and I got the following problem:
>>
>> /opt/src/gnomecvs/ORBit/src/services/name/naming-client.c:63: undefined
>> reference to `strndup'
>
>It didn't exist on my Solaris 2.6 system either. I made the following
>changes. I use malloc(), since that is what str(n)dup uses. Maybe it
>should use g_malloc instead.
>
>--- naming-client.c 1998/08/18 01:05:28 1.5
>+++ naming-client.c 1998/08/19 13:44:55
>@@ -3,6 +3,7 @@
> #include <ctype.h>
> #include <string.h>
> #include <limits.h>
>+#include <stdlib.h>
>
> typedef enum {nom_bind, rebind, bind_context, rebind_context, unbind,
resolve,
> new_context, bind_new_context, destroy, not_set} mode_type;
>@@ -48,7 +49,7 @@
> {
> static CosNaming_Name name = { 0, 0, NULL };
> int i, n;
>- char *t;
>+ int t;
>
> CORBA_free( name._buffer );
>
>@@ -59,10 +60,12 @@
> name._buffer = CORBA_sequence_CosNaming_NameComponent_allocbuf( n + 1 );
> name._length = n + 1;
> for(i = 0; i <= n; i++) {
>- t = strchr(string, '/');
>- name._buffer[ i ].id = strndup(string, t?(t - string):INT_MAX);
>+ t = strcspn(string, "/\0");
>+ name._buffer[ i ].id = /*g_*/malloc( t + 1 );
>+ strncpy( name._buffer[ i ].id, string, t );
>+ name._buffer[ i ].id[ t ] = 0;
> name._buffer[ i ].kind = name._buffer[i].id;
>- string = t + 1;
>+ string += t + 1;
> }
> CORBA_sequence_set_release(&name, FALSE);
> return( &name );
>
>
>--
>David Kågedal <davidk@lysator.liu.se>
http://www.lysator.liu.se/~davidk/
>
>
>--
> To unsubscribe: mail gnome-list-request@gnome.org with
> "unsubscribe" as the Subject.
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]