# [PATCH] wcwidth redeclaration

4 messages from 2007-05-08 to 2007-05-08. Participants: Amos Waterland, Junio C Hamano, Johannes Schindelin.
Thread: https://gitlist.dev/t/8029

## Amos Waterland, 2007-05-08 04:46

Subject: [PATCH] wcwidth redeclaration
Message-ID: <20070508044608.GA32223@us.ibm.com>
URL: https://gitlist.dev/e/20070508044608.GA32223%40us.ibm.com

```
Build fails for git 1.5.1.3 on AIX, with the message: 

utf8.c:66: error: conflicting types for 'wcwidth'
/.../lib/gcc/powerpc-ibm-aix5.3.0.0/4.0.3/include/string.h:266: error: previous declaration of 'wcwidth' was here

Here is a patch that fixes it for me.  If there is a different way that
is preferred, please let me know.

Signed-off-by: Amos Waterland <apw@us.ibm.com>

---

 utf8.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- utf8.c.orig	Tue May  8 00:40:18 2007
+++ utf8.c	Tue May  8 00:45:00 2007
@@ -62,7 +62,7 @@
  * in ISO 10646.
  */
 
-static int wcwidth(ucs_char_t ch)
+static int git_wcwidth(ucs_char_t ch)
 {
 	/*
 	 * Sorted list of non-overlapping intervals of non-spacing characters,
@@ -207,7 +207,7 @@
 		return 0;
 	}
 
-	return wcwidth(ch);
+	return git_wcwidth(ch);
 }
 
 int is_utf8(const char *text)

```

## Junio C Hamano, 2007-05-08 05:02

Subject: Re: [PATCH] wcwidth redeclaration
Message-ID: <7vmz0f52no.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vmz0f52no.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <20070508044608.GA32223@us.ibm.com>

```
apw@us.ibm.com (Amos Waterland) writes:

> Build fails for git 1.5.1.3 on AIX, with the message: 
>
> utf8.c:66: error: conflicting types for 'wcwidth'
> /.../lib/gcc/powerpc-ibm-aix5.3.0.0/4.0.3/include/string.h:266: error: previous declaration of 'wcwidth' was here
>
> Here is a patch that fixes it for me.  If there is a different way that
> is preferred, please let me know.

It's static in that file, so renaming our version to our own
name as you did is perfectly good.

Thanks for helping, as not many people seem to be on AIX on this
list.

```

## Johannes Schindelin, 2007-05-08 10:03

Subject: Re: [PATCH] wcwidth redeclaration
Message-ID: <Pine.LNX.4.64.0705081202080.4167@racer.site>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0705081202080.4167%40racer.site
In-Reply-To: <7vmz0f52no.fsf@assigned-by-dhcp.cox.net>

```
Hi,

On Mon, 7 May 2007, Junio C Hamano wrote:

> apw@us.ibm.com (Amos Waterland) writes:
> 
> > Build fails for git 1.5.1.3 on AIX, with the message: 
> >
> > utf8.c:66: error: conflicting types for 'wcwidth'
> > /.../lib/gcc/powerpc-ibm-aix5.3.0.0/4.0.3/include/string.h:266: error: previous declaration of 'wcwidth' was here
> >
> > Here is a patch that fixes it for me.  If there is a different way that
> > is preferred, please let me know.
> 
> It's static in that file, so renaming our version to our own
> name as you did is perfectly good.
> 
> Thanks for helping, as not many people seem to be on AIX on this
> list.

Thanks indeed. I thought that a static function could shadow a global 
function, but probably not with a different signature. Just out of 
curiosity: what is the signature of wcwidth in your string.h?

Ciao,
Dscho

```

## Amos Waterland, 2007-05-08 17:18

Subject: Re: [PATCH] wcwidth redeclaration
Message-ID: <20070508171855.GA19533@us.ibm.com>
URL: https://gitlist.dev/e/20070508171855.GA19533%40us.ibm.com
In-Reply-To: <Pine.LNX.4.64.0705081202080.4167@racer.site>

```
On Tue, May 08, 2007 at 12:03:47PM +0200, Johannes Schindelin wrote:
> Thanks indeed. I thought that a static function could shadow a global 
> function, but probably not with a different signature. Just out of 
> curiosity: what is the signature of wcwidth in your string.h?

This is it:

        extern int      wcwidth(wchar_t);

```
