summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-07-22 13:41:07 -0400
committerH. Peter Anvin <hpa@zytor.com>2008-07-22 13:41:07 -0400
commit81e4821f2a9507238cfda0c665933eb8a23c9c5b (patch)
tree1d99fe1dc737a4967de7ccc4728b2b1391184af9
parent559ea7abec1acb497eca0bd74a583713e425302b (diff)
downloadsyslinux-81e4821f2a9507238cfda0c665933eb8a23c9c5b.tar.gz
Simplify and fix label string scanning
Simplify and fix bugs in the code to store and match label names without filename mangling. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--core/parseconfig.inc6
-rw-r--r--core/ui.inc16
2 files changed, 7 insertions, 15 deletions
diff --git a/core/parseconfig.inc b/core/parseconfig.inc
index 843a733f..4a38c35d 100644
--- a/core/parseconfig.inc
+++ b/core/parseconfig.inc
@@ -312,10 +312,8 @@ pc_label: call commit_vk ; Commit any current vkernel
lodsb
cmp al,' '
jna .done
- mov [di],al
- inc di
- dec cx
- jnz .loop
+ stosb
+ loop .loop
.done:
mov byte [VKernel],1 ; We've seen a "label" statement
mov si,VKernelBuf+vk_vname ; By default, rname == vname
diff --git a/core/ui.inc b/core/ui.inc
index 0ff9d104..26b6fa09 100644
--- a/core/ui.inc
+++ b/core/ui.inc
@@ -309,24 +309,18 @@ vk_check:
sub di,cx ; Return to beginning of buf
push si
mov si,command_line
- mov cx,FILENAME_MAX
.loop:
- dec cx
- jz .done
lodsb
- mov ah,[di]
- inc di
- cmp ah,al
- je .match
- jmp .nomatch
-.match:
cmp al,' '
- jna .done
- jmp .loop
+ jbe .done
+ scasb
+ je .loop
.nomatch:
pop si
jmp .scan
.done:
+ cmp byte [di],0 ; Must match end of string
+ jne .nomatch
pop si
;