make(1): remove __predict_false

The effect (at least on x86_64) is so minimal that it is not worth
cluttering the code.
This commit is contained in:
rillig 2021-01-30 21:18:14 +00:00
parent 989db9a096
commit 0d32771f00
2 changed files with 5 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: buf.c,v 1.50 2021/01/30 21:03:32 rillig Exp $ */
/* $NetBSD: buf.c,v 1.51 2021/01/30 21:18:14 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -75,7 +75,7 @@
#include "make.h"
/* "@(#)buf.c 8.1 (Berkeley) 6/6/93" */
MAKE_RCSID("$NetBSD: buf.c,v 1.50 2021/01/30 21:03:32 rillig Exp $");
MAKE_RCSID("$NetBSD: buf.c,v 1.51 2021/01/30 21:18:14 rillig Exp $");
/* Make space in the buffer for adding at least 16 more bytes. */
void
@ -92,7 +92,7 @@ Buf_AddBytes(Buffer *buf, const char *bytes, size_t bytes_len)
size_t old_len = buf->len;
char *end;
if (__predict_false(old_len + bytes_len >= buf->cap)) {
if (old_len + bytes_len >= buf->cap) {
size_t minIncr = bytes_len + 16;
buf->cap += buf->cap > minIncr ? buf->cap : minIncr;
buf->data = bmake_realloc(buf->data, buf->cap);

View File

@ -1,4 +1,4 @@
/* $NetBSD: buf.h,v 1.40 2021/01/30 21:03:32 rillig Exp $ */
/* $NetBSD: buf.h,v 1.41 2021/01/30 21:18:14 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -86,11 +86,6 @@ typedef struct Buffer {
char *data; /* The buffer itself (always null-terminated) */
} Buffer;
/* If we aren't on NetBSD, __predict_false() might not be defined. */
#ifndef __predict_false
#define __predict_false(x) (x)
#endif
void Buf_Expand(Buffer *);
/* Buf_AddByte adds a single byte to a buffer. */
@ -99,7 +94,7 @@ Buf_AddByte(Buffer *buf, char byte)
{
size_t old_len = buf->len++;
char *end;
if (__predict_false(old_len + 1 >= buf->cap))
if (old_len + 1 >= buf->cap)
Buf_Expand(buf);
end = buf->data + old_len;
end[0] = byte;