File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8453,16 +8453,7 @@ hist_store proc
84538453 mov bx ,[ line_hist_begin ]
84548454 mov di ,[ line_hist_end ]
84558455 test di , di
8456- jnz initialized
8457- first:
8458- mov di , offset line_history ;create first node
8459- mov bx , di
8460- mov [ line_hist_begin ], di
8461- mov [ line_hist_end ], di
8462- mov [ di .llnode.next ], 0
8463- mov [ di .llnode.prev ], 0
8464- jmp store
8465- initialized:
8456+ jz first
84668457 add di , sizeof llnode
84678458 push cx
84688459 repe cmpsb ;check if last entry is identical
@@ -8475,15 +8466,16 @@ initialized:
84758466 repne scasb ;find end of last node
84768467 pop cx
84778468 mov si , di
8478- @@: mov di , si
8469+ check_overflow:
8470+ mov di , si
84798471 add di , cx
84808472 add di , sizeof llnode ;di = end of new node
84818473 cmp di , offset line_history + LINE_HISTORY_LEN
84828474 jb no_overflow ;does it fit?
84838475 cmp si , offset line_history
84848476 je fail ;fail if new node would be larger than buffer
84858477 mov si , offset line_history ;restart from beginning
8486- jmp @B
8478+ jmp check_overflow
84878479no_overflow:
84888480 cmp si , bx
84898481 ja no_overlap ;can't overlap if buffer isn't full yet
@@ -8511,6 +8503,15 @@ fail:
85118503 pop ax
85128504 pop si
85138505 ret
8506+
8507+ first:
8508+ mov di , offset line_history ;create first node
8509+ mov bx , di
8510+ mov [ line_hist_begin ], di
8511+ mov [ line_hist_end ], di
8512+ mov [ di .llnode.next ], 0
8513+ mov [ di .llnode.prev ], 0
8514+ jmp store
85148515hist_store endp
85158516
85168517; BUFSETUP - Set up buffer reading. This just means discard an LF
You can’t perform that action at this time.
0 commit comments