Re: uc_width and wcwidth optimization

2013-12-13 Thread Alexander V. Lukyanov
On 12/13/2011 11:32 AM, Bruno Haible wrote: > I would love to have locale_charset be either faster or use some thread-safe > cache. Do you have an idea how to realize this? For quite some time I use this locale_charset optimization, which uses binary search for locale alias resolution. -- Ale

gl_openssl.h and c++

2013-12-12 Thread Alexander V. Lukyanov
Hello! This patch is required to compile gl_openssl.h in c++ mode. -- Alexander. diff --git a/lib/gl_openssl.h b/lib/gl_openssl.h index 1fb6106..bcdbbef 100644 --- a/lib/gl_openssl.h +++ b/lib/gl_openssl.h @@ -91,18 +91,18 @@ GL_CRYPTO_FN (_process_block) (const void *buf, size_t len, struct

Re: lftp fails to build with current gnulib: 'gets' undeclared here

2012-12-06 Thread Alexander V. Lukyanov
On Thu, Dec 06, 2012 at 03:58:17PM -0700, Eric Blake wrote: > Why is lftp using C++ for configure but not at compile time? The > configure tests should match the compilation environment? Because lftp contains source files in both C _and_ C++. > I'm not sure if we need to do something in gnulib,

[j...@gentoo.org: [lftp] [PATCH] Fix building against GNU libc 2.16 (gets undefined)]

2012-08-09 Thread Alexander V. Lukyanov
Please consider this patch for gnulib. - Forwarded message from Jeroen Roovers - Date: Thu, 9 Aug 2012 12:48:40 +0200 From: Jeroen Roovers To: l...@uniyar.ac.ru Subject: [lftp] [PATCH] Fix building against GNU libc 2.16 (gets undefined) X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.10; i686-pc-

Re: inttypes.h compile error

2011-12-15 Thread Alexander V. Lukyanov
On Thu, Dec 15, 2011 at 11:50:23AM -0800, Paul Eggert wrote: > On 12/15/11 04:50, Alexander V. Lukyanov wrote: > > I get this message in a C++ program on linux (glibc-2.14). > > > > ../lib/inttypes.h:58:3: error: #error "This file assumes that 'int' has >

inttypes.h compile error

2011-12-15 Thread Alexander V. Lukyanov
I get this message in a C++ program on linux (glibc-2.14). ../lib/inttypes.h:58:3: error: #error "This file assumes that 'int' has exactly 32 bits. Please report your platform and compiler to ." I think it's because of this in /usr/include/stdint.h: /* The ISO C99 standard specifies that in C++

Re: uc_width and wcwidth optimization

2011-12-15 Thread Alexander V. Lukyanov
Here is another patch which changes linear search to bsearch. With charset aliases of DARWIN7 case I get 10 times reduction of benchmark execution time. This patch should be thread-safe, in worst case it would leak some memory _once_ (just as before). -- Alexander. diff --git a/lib/localchar

Re: uc_width and wcwidth optimization

2011-12-14 Thread Alexander V. Lukyanov
On Wed, Dec 14, 2011 at 02:02:33PM +0400, Alexander V. Lukyanov wrote: > It means that it is possible to avoid is_cjk_encoding() calling at all, > because uc_width only uses encoding for cjk checking and uc_width is only > called by wcwidth for UTF-8 case (which is not a cjk encoding).

Re: uc_width and wcwidth optimization

2011-12-14 Thread Alexander V. Lukyanov
On Wed, Dec 14, 2011 at 02:02:33PM +0400, Alexander V. Lukyanov wrote: > is_cjk_encoding() is on the second place after locale_charset. * Only in certain cases. -- Alexander.

Re: uc_width and wcwidth optimization

2011-12-14 Thread Alexander V. Lukyanov
On Wed, Dec 14, 2011 at 02:06:45PM +0400, Alexander V. Lukyanov wrote: > On Tue, Dec 13, 2011 at 11:32:53AM +0100, Bruno Haible wrote: > > I would love to have locale_charset be either faster or use some thread-safe > > cache. Do you have an idea how to realize this? > > B

Re: uc_width and wcwidth optimization

2011-12-14 Thread Alexander V. Lukyanov
On Tue, Dec 13, 2011 at 11:32:53AM +0100, Bruno Haible wrote: > 2) The wcwidth change is a good idea, but unfortunately is not multithread- > safe. Different threads can have different locales, therefore a global > variable as a cache won't lead to correct results always. Fortunately c

Re: uc_width and wcwidth optimization

2011-12-14 Thread Alexander V. Lukyanov
On Tue, Dec 13, 2011 at 11:32:53AM +0100, Bruno Haible wrote: > I would love to have locale_charset be either faster or use some thread-safe > cache. Do you have an idea how to realize this? BTW, is it possible to hook setlocale call to reset or disable the cache? E.g. save thread-id with the cac

uc_width and wcwidth optimization

2011-12-09 Thread Alexander V. Lukyanov
Hello! Attached is the patch to optimize performance of wcwith, uc_width and uc{8,16,32}_width functions. The optimization is caching of is_cjk_encoding() and using nl_langinfo(CODESET) before the complex locale_charset() to check if the charset has changed. Besides, uc_width is used in wcwidth

sys_stat

2008-11-05 Thread Alexander V. Lukyanov
Here is a patch to allow proper linking of rpl_lstat in C++ programs. diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h index 234b527..50fb524 100644 --- a/lib/sys_stat.in.h +++ b/lib/sys_stat.in.h @@ -41,6 +41,10 @@ #ifndef _GL_SYS_STAT_H #define _GL_SYS_STAT_H +#ifdef __cplusplus +extern "C"

Re: wcwidth replacement problems

2008-08-28 Thread Alexander V. Lukyanov
On Tue, Aug 26, 2008 at 09:32:32AM +0200, Bruno Haible wrote: > Probably the Solaris wcwidth is made to match some Japanese terminal > emulators, rather than xterm? In such terminal emulators, many characters > that have width 1 in xterm are represented with width 2. > > U+2022 (BULLET) is designa

Re: wcwidth replacement problems

2008-08-26 Thread Alexander V. Lukyanov
On Tue, Aug 26, 2008 at 09:32:32AM +0200, Bruno Haible wrote: > Alexander V. Lukyanov wrote: > > Let's measure it. > > > > $ time ./wcwidth-solaris > > wcwidth(0x2022)=2 > > > > real0m2.205s > > user0m2.200s > > sys 0m0.0

Re: wcwidth replacement problems

2008-08-25 Thread Alexander V. Lukyanov
On Sun, Aug 24, 2008 at 12:29:06PM +0200, Bruno Haible wrote: > > +dnl On Solaris 8, wcwidth(0x2022) (BULLET) returns -1. > > This is not the case for me: I'm sorry. In my case it also gives 2, not -1. (I forgot to call setlocale in the new test program, oops). New patch attached. > Which lo

wcwidth replacement problems

2008-08-23 Thread Alexander V. Lukyanov
Hello! I'm trying to use wcwith replacement on Solaris 8 and have noticed some problems. At first, the test for replacement did not detect the problem and thus did not replace the system function (patch for this is attached). Then I have noticed that the replacement function is slow and broken. A