make a few functions static that should be, and optimise a little
This commit is contained in:
parent
c43e701025
commit
bc215df211
21
edit.c
21
edit.c
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.61 2006/11/09 15:02:30 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.62 2006/11/09 21:20:49 tg Exp $");
|
||||||
|
|
||||||
/* tty driver characters we are interested in */
|
/* tty driver characters we are interested in */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -863,7 +863,8 @@ static size_t mbxtowc(unsigned *, const char *);
|
|||||||
static size_t wcxtomb(char *, unsigned);
|
static size_t wcxtomb(char *, unsigned);
|
||||||
static int wcxwidth(unsigned);
|
static int wcxwidth(unsigned);
|
||||||
static int x_e_getmbc(char *);
|
static int x_e_getmbc(char *);
|
||||||
char *utf_getcpfromcols(char *, int);
|
static char *utf_getcpfromcols(char *, int);
|
||||||
|
static void utf_ptradj(char *, char **);
|
||||||
|
|
||||||
/* UTF-8 hack: high-level functions */
|
/* UTF-8 hack: high-level functions */
|
||||||
|
|
||||||
@ -880,13 +881,11 @@ char *utf_getcpfromcols(char *, int);
|
|||||||
int
|
int
|
||||||
utf_widthadj(const char *src, const char **dst)
|
utf_widthadj(const char *src, const char **dst)
|
||||||
{
|
{
|
||||||
size_t len = (size_t)-1;
|
size_t len;
|
||||||
unsigned wc;
|
unsigned wc;
|
||||||
|
|
||||||
if (Flag(FUTFHACK) && *(const unsigned char *)src > 0x7F)
|
if (!Flag(FUTFHACK) || *(const unsigned char *)src <= 0x7F ||
|
||||||
len = mbxtowc(&wc, src);
|
(len = mbxtowc(&wc, src)) == (size_t)-1) {
|
||||||
|
|
||||||
if (len == (size_t)-1) {
|
|
||||||
if (dst)
|
if (dst)
|
||||||
*dst = src + 1;
|
*dst = src + 1;
|
||||||
return (1);
|
return (1);
|
||||||
@ -897,7 +896,7 @@ utf_widthadj(const char *src, const char **dst)
|
|||||||
return (wcxwidth(wc));
|
return (wcxwidth(wc));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
utf_ptradj(char *src, char **dst)
|
utf_ptradj(char *src, char **dst)
|
||||||
{
|
{
|
||||||
size_t len;
|
size_t len;
|
||||||
@ -921,7 +920,7 @@ utf_ptradj(char *src, char **dst)
|
|||||||
*dst = src + len;
|
*dst = src + len;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
static char *
|
||||||
utf_getcpfromcols(char *p, int cols)
|
utf_getcpfromcols(char *p, int cols)
|
||||||
{
|
{
|
||||||
int c = 0;
|
int c = 0;
|
||||||
@ -1018,7 +1017,7 @@ wcxwidth_bisearch(unsigned ucs, const struct wcxwidth_interval *table, size_t ma
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
wcxwidth(unsigned c)
|
wcxwidth(unsigned c)
|
||||||
{
|
{
|
||||||
/* test for 8-bit control characters */
|
/* test for 8-bit control characters */
|
||||||
@ -1047,7 +1046,7 @@ wcxwidth(unsigned c)
|
|||||||
/* --- begin of mbrtowc.c excerpt --- */
|
/* --- begin of mbrtowc.c excerpt --- */
|
||||||
__RCSID("_MirOS: src/lib/libc/i18n/mbrtowc.c,v 1.13 2006/11/01 20:01:19 tg Exp $");
|
__RCSID("_MirOS: src/lib/libc/i18n/mbrtowc.c,v 1.13 2006/11/01 20:01:19 tg Exp $");
|
||||||
|
|
||||||
size_t
|
static size_t
|
||||||
mbxtowc(unsigned *dst, const char *src)
|
mbxtowc(unsigned *dst, const char *src)
|
||||||
{
|
{
|
||||||
const unsigned char *s = (const unsigned char *)src;
|
const unsigned char *s = (const unsigned char *)src;
|
||||||
|
3
sh.h
3
sh.h
@ -8,7 +8,7 @@
|
|||||||
/* $OpenBSD: c_test.h,v 1.4 2004/12/20 11:34:26 otto Exp $ */
|
/* $OpenBSD: c_test.h,v 1.4 2004/12/20 11:34:26 otto Exp $ */
|
||||||
/* $OpenBSD: tty.h,v 1.5 2004/12/20 11:34:26 otto Exp $ */
|
/* $OpenBSD: tty.h,v 1.5 2004/12/20 11:34:26 otto Exp $ */
|
||||||
|
|
||||||
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.61 2006/11/09 21:00:13 tg Exp $"
|
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.62 2006/11/09 21:20:49 tg Exp $"
|
||||||
#define MKSH_VERSION "R29 2006/11/09"
|
#define MKSH_VERSION "R29 2006/11/09"
|
||||||
|
|
||||||
#if HAVE_SYS_PARAM_H
|
#if HAVE_SYS_PARAM_H
|
||||||
@ -1061,7 +1061,6 @@ int x_bind(const char *, const char *, int, int);
|
|||||||
/* UTF-8 hack stuff */
|
/* UTF-8 hack stuff */
|
||||||
int utf_widthadj(const char *, const char **);
|
int utf_widthadj(const char *, const char **);
|
||||||
#define utf_width(x) utf_widthadj(x, NULL);
|
#define utf_width(x) utf_widthadj(x, NULL);
|
||||||
void utf_ptradj(char *, char **);
|
|
||||||
/* eval.c */
|
/* eval.c */
|
||||||
char *substitute(const char *, int);
|
char *substitute(const char *, int);
|
||||||
char **eval(char **, int);
|
char **eval(char **, int);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user