From: Nirbhay Choubey Date: September 29 2011 9:06am Subject: bzr push into mysql-trunk branch (nirbhay.choubey:3243 to 3244) WL#5945 List-Archive: http://lists.mysql.com/commits/141196 Message-Id: <201109290906.p8T96Mkh022953@acsmt357.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3244 Nirbhay Choubey 2011-09-29 WL#5945 : Improve libedit library Added wcsdup's implementation which might be missing on some platforms. added: cmd-line-utils/libedit/np/wcsdup.c modified: cmd-line-utils/libedit/CMakeLists.txt cmd-line-utils/libedit/chartype.h 3243 Nirbhay Choubey 2011-09-23 Fixing build failures on FreeBSD and Darwin. modified: cmd-line-utils/libedit/chartype.h cmd-line-utils/libedit/sys.h === modified file 'cmd-line-utils/libedit/CMakeLists.txt' --- a/cmd-line-utils/libedit/CMakeLists.txt 2011-08-15 06:46:56 +0000 +++ b/cmd-line-utils/libedit/CMakeLists.txt 2011-09-29 09:04:23 +0000 @@ -100,6 +100,11 @@ IF(NOT HAVE_FGETLN) SET(LIBEDIT_EXTRA_SOURCES ${LIBEDIT_EXTRA_SOURCES} np/fgetln.c) ENDIF() +CHECK_FUNCTION_EXISTS(fgetln HAVE_WCSDUP) +IF(NOT HAVE_WCSDUP) + SET(LIBEDIT_EXTRA_SOURCES ${LIBEDIT_EXTRA_SOURCES} np/wcsdup.c) +ENDIF() + # Generate headers FOREACH(SRCBASENAME vi emacs common) SET(SRC ${CMAKE_CURRENT_SOURCE_DIR}/${SRCBASENAME}.c) === modified file 'cmd-line-utils/libedit/chartype.h' --- a/cmd-line-utils/libedit/chartype.h 2011-09-23 15:07:31 +0000 +++ b/cmd-line-utils/libedit/chartype.h 2011-09-29 09:04:23 +0000 @@ -65,6 +65,10 @@ #warning Build environment does not support non-BMP characters #endif +#ifndef HAVE_WCSDUP +wchar_t *wcsdup(const wchar_t *s); +#endif + #define ct_wctomb wctomb #define ct_wctomb_reset wctomb(0,0) #define ct_wcstombs wcstombs === added file 'cmd-line-utils/libedit/np/wcsdup.c' --- a/cmd-line-utils/libedit/np/wcsdup.c 1970-01-01 00:00:00 +0000 +++ b/cmd-line-utils/libedit/np/wcsdup.c 2011-09-29 09:04:23 +0000 @@ -0,0 +1,43 @@ +/* $NetBSD: wcsdup.c,v 1.3 2008/05/26 13:17:48 haad Exp $ */ + +/* + * Copyright (C) 2006 Aleksey Cheusov + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee. Permission to modify the code and to distribute modified + * code is also granted without any restrictions. + */ + +#ifndef HAVE_WCSDUP + +#include "config.h" + +#if defined(LIBC_SCCS) && !defined(lint) +__RCSID("$NetBSD: wcsdup.c,v 1.3 2008/05/26 13:17:48 haad Exp $"); +#endif /* LIBC_SCCS and not lint */ + +#include +#include +#include + +wchar_t * +wcsdup(const wchar_t *str) +{ + wchar_t *copy; + size_t len; + + _DIAGASSERT(str != NULL); + + len = wcslen(str) + 1; + copy = malloc(len * sizeof (wchar_t)); + + if (!copy) + return NULL; + + return wmemcpy(copy, str, len); +} + +#endif No bundle (reason: useless for push emails).