maint: update the mbsalign module
authorPádraig Brady <P@draigBrady.com>
Mon, 15 Mar 2010 14:04:31 +0000 (14:04 +0000)
committerPádraig Brady <P@draigBrady.com>
Fri, 19 Mar 2010 19:23:45 +0000 (19:23 +0000)
commitdfe0d336a00940c8e13c24b6d5d7485a2d7310b0
treede0b56d0af4ba442f070cef2ec717de9c4066a48
parent3dcbcf98f427f8ab6ceafd27396adae4b2276bb8
maint: update the mbsalign module

* gl/lib/mbsalign.c (mbsalign):  Support the MBA_UNIBYTE_FALLBACK
flag which reverts to unibyte mode if one can't allocate memory
or if there are invalid multibyte characters present.
Note memory is no longer dynamically allocated in unibyte mode so
one can assume that mbsalign() will not return an error if this
flag is present.  Don't calculate twice, the number of spaces,
when centering.  Suppress a signed/unsigned comparison warning.
(ambsalign): A new wrapper function to dynamically allocate
the minimum memory required to hold the aligned string.
* gl/lib/mbsalign.h: Add the MBA_UNIBYTE_FALLBACK flag and
also document others that may be implemented in future.
(ambsalign): A prototype for the new wrapper.
* gl/tests/test-mbsalign.c (main): New test program.
* gl/modules/mbsalign-tests: A new index to reference the tests.
* .x-sc_program_name: Exclude test-mbsalign.c from this check.
.x-sc_program_name
gl/lib/mbsalign.c
gl/lib/mbsalign.h
gl/modules/mbsalign-tests [new file with mode: 0644]
gl/tests/test-mbsalign.c [new file with mode: 0644]