Use strchr and strlen more often; also use strchr in the init code.
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@842 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
parent
deecf43882
commit
83f044fbe0
@ -335,8 +335,6 @@ dostrlen:
|
||||
|
||||
jmp short pascal_return
|
||||
|
||||
%ifndef _INIT
|
||||
|
||||
;************************************************************
|
||||
; strchr (BYTE *src , int ch);
|
||||
|
||||
@ -369,6 +367,7 @@ strchr_found1:
|
||||
|
||||
jmp short pascal_return
|
||||
|
||||
%ifndef _INIT
|
||||
|
||||
;*****
|
||||
; fstrchr (BYTE far *src , int ch);
|
||||
|
@ -80,13 +80,10 @@ STATIC void WriteMenuLine(int MenuSelected)
|
||||
iregs r;
|
||||
unsigned char attr = (unsigned char)MenuColor;
|
||||
char *pText = MenuStruct[MenuSelected].Text;
|
||||
size_t len = 0;
|
||||
|
||||
if (pText[0] == 0)
|
||||
return;
|
||||
|
||||
do len++; while (pText[len]);
|
||||
|
||||
if(MenuStruct[MenuSelected].bSelected==1)
|
||||
attr = ((attr << 4) | (attr >> 4));
|
||||
|
||||
@ -95,7 +92,7 @@ STATIC void WriteMenuLine(int MenuSelected)
|
||||
r.b.b.h = attr;
|
||||
r.c.b.l = r.d.b.l = MenuStruct[MenuSelected].x;
|
||||
r.c.b.h = r.d.b.h = MenuStruct[MenuSelected].y;
|
||||
r.d.b.l += len - 1;
|
||||
r.d.b.l += strlen(pText) - 1;
|
||||
init_call_intr(0x10, &r);
|
||||
|
||||
/* set cursor position: */
|
||||
@ -952,15 +949,13 @@ STATIC VOID sysScreenMode(BYTE * pLine)
|
||||
STATIC VOID sysVersion(BYTE * pLine)
|
||||
{
|
||||
COUNT major, minor;
|
||||
char *p;
|
||||
char *p = strchr(pLine, '.');
|
||||
|
||||
p = pLine;
|
||||
while (*p && *p != '.')
|
||||
p++;
|
||||
|
||||
if (*p++ == '\0')
|
||||
if (p == NULL)
|
||||
return;
|
||||
|
||||
p++;
|
||||
|
||||
/* Get major number */
|
||||
if (GetNumArg(pLine, &major) == (BYTE *) 0)
|
||||
return;
|
||||
@ -2561,10 +2556,8 @@ STATIC VOID InstallExec(struct instCmds *icmd)
|
||||
*d = 0;
|
||||
|
||||
args--;
|
||||
*args = 0;
|
||||
while (args[*args+1])
|
||||
++*args;
|
||||
args[*args+1] = '\r';
|
||||
*args = strlen(&args[1]);
|
||||
args[*args+1] = '\r';
|
||||
args[*args+2] = 0;
|
||||
|
||||
exb.exec.env_seg = 0;
|
||||
|
@ -58,10 +58,11 @@ VOID ASMPASCAL fmemcpy( void FAR *d, const void FAR *s, size_t n);
|
||||
VOID ASMPASCAL strcpy(char *d, const char *s);
|
||||
size_t ASMPASCAL strlen(const char *s);
|
||||
size_t ASMPASCAL fstrlen(const char FAR *s);
|
||||
char * ASMPASCAL strchr(const char *s, int ch);
|
||||
|
||||
#ifdef __WATCOMC__
|
||||
/* dx and es not used or clobbered for all asmsupt.asm functions except
|
||||
(f)memchr/(f)strchr (which preserve es) */
|
||||
/* bx, cx, dx and es not used or clobbered for all asmsupt.asm functions except
|
||||
(f)memchr/(f)strchr (which clobber dx) */
|
||||
#pragma aux (pascal) pascal_ax modify exact [ax]
|
||||
#pragma aux (pascal_ax) init_memset
|
||||
#pragma aux (pascal_ax) init_fmemset
|
||||
@ -72,6 +73,7 @@ size_t ASMPASCAL fstrlen(const char FAR *s);
|
||||
#pragma aux (pascal_ax) init_strcpy
|
||||
#pragma aux (pascal_ax) init_strlen modify nomemory
|
||||
#pragma aux (pascal_ax) init_fstrlen modify nomemory
|
||||
#pragma aux (pascal) init_strchr modify exact [ax dx] nomemory
|
||||
#endif
|
||||
|
||||
#undef LINESIZE
|
||||
|
Loading…
Reference in New Issue
Block a user