klibc-bot for Herbert Xu
2019-Jan-25  03:15 UTC
[klibc] [klibc:update-dash] [OUTPUT] Add likely tag in outmem
Commit-ID:  3bfbb8db1389fde819e28273b8e85262e58a9a1b
Gitweb:    
http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=3bfbb8db1389fde819e28273b8e85262e58a9a1b
Author:     Herbert Xu <herbert at gondor.apana.org.au>
AuthorDate: Mon, 27 Oct 2014 15:42:23 +0800
Committer:  Ben Hutchings <ben at decadent.org.uk>
CommitDate: Fri, 25 Jan 2019 02:57:21 +0000
[klibc] [OUTPUT] Add likely tag in outmem
The branch in outmem where the string fits in the buffer is the
common case and is now marked as likely.
Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au>
Signed-off-by: Ben Hutchings <ben at decadent.org.uk>
---
 usr/dash/output.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/usr/dash/output.c b/usr/dash/output.c
index 1b20850a..3e1ae256 100644
--- a/usr/dash/output.c
+++ b/usr/dash/output.c
@@ -144,7 +144,7 @@ outmem(const char *p, size_t len, struct output *dest)
 	size_t nleft;
 
 	nleft = dest->end - dest->nextc;
-	if (nleft >= len) {
+	if (likely(nleft >= len)) {
 buffered:
 		dest->nextc = mempcpy(dest->nextc, p, len);
 		return;
Possibly Parallel Threads
- [klibc:update-dash] dash: [OUTPUT] Add likely tag in outmem
- [klibc:update-dash] [BUILTIN] Handle embedded NULs correctly in printf
- [klibc:update-dash] dash: [BUILTIN] Handle embedded NULs correctly in printf
- [klibc:update-dash] dash: input: Move all input state into parsefile
- [klibc:update-dash] input: Move all input state into parsefile
