Align scope and parameter type for linsert and is_beginning_utf8.

This commit is contained in:
Renaud 2015-02-02 19:44:35 +08:00
parent 83b323272d
commit de04424e51
3 changed files with 9 additions and 11 deletions

13
line.c
View File

@ -32,6 +32,10 @@ int tabmask = 0x07 ; /* tabulator mask */
static int ldelnewline( void) ;
static inline int is_beginning_utf8( unsigned char c) {
return (c & 0xc0) != 0x80;
}
/* The editor holds deleted text chunks in the struct kill buffer. The
* kill buffer is logically a stream of ascii characters, however
* due to its unpredicatable size, it gets implemented as a linked
@ -261,11 +265,11 @@ int linstr( char *instr) {
int status = TRUE ;
if( instr != NULL) {
char tmpc ;
unicode_t tmpc ;
while( (tmpc = *instr++)) {
while( (tmpc = *instr++ & 0xFF)) {
status =
(tmpc == '\n' ? lnewline() : linsert( 1, tmpc & 0xFF)) ;
(tmpc == '\n' ? lnewline() : linsert( 1, tmpc)) ;
/* Insertion error? */
if( status != TRUE) {
@ -369,8 +373,7 @@ static int linsert_byte(int n, int c)
return TRUE;
}
int linsert(int n, int c)
{
int linsert( int n, unicode_t c) {
char utf8[6];
int bytes, i ;

2
line.h
View File

@ -38,7 +38,7 @@ void lfree( struct line *lp) ;
void lchange( int flag) ;
int insspace( int f, int n) ;
int linstr( char *instr) ;
int linsert( int n, int c) ;
int linsert( int n, unicode_t c) ;
int lover( char *ostr) ;
int lnewline( void) ;
int ldelete( long n, int kflag) ;

5
utf8.h
View File

@ -7,9 +7,4 @@ unsigned utf8_to_unicode( char *line, unsigned index, unsigned len,
unicode_t *res) ;
unsigned unicode_to_utf8( unsigned int c, char *utf8) ;
static inline int is_beginning_utf8( unsigned char c)
{
return (c & 0xc0) != 0x80;
}
#endif