Merge "Sync upstream OpenBSD." into main am: 6de9b74b73

Original change: https://android-review.googlesource.com/c/platform/bionic/+/2665210

Change-Id: I17f50a5e1aa4b705cffc22122e18cb5ecd2a1200
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot 2023-07-20 15:02:31 +00:00 committed by Automerger Merge Worker
commit dc4b8d2c11
2 changed files with 3 additions and 7 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: open_memstream.c,v 1.8 2019/05/02 08:30:10 yasuoka Exp $ */
/* $OpenBSD: open_memstream.c,v 1.10 2023/07/11 12:14:16 claudio Exp $ */
/*
* Copyright (c) 2011 Martin Pieuchot <mpi@openbsd.org>
@ -53,7 +53,6 @@ memstream_write(void *v, const char *b, int l)
p = recallocarray(st->string, st->size, sz, 1);
if (!p)
return (-1);
bzero(p + st->size, sz - st->size);
*st->pbuf = st->string = p;
st->size = sz;
}
@ -136,7 +135,6 @@ open_memstream(char **pbuf, size_t *psize)
return (NULL);
}
*st->string = '\0';
st->pos = 0;
st->len = 0;
st->pbuf = pbuf;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: open_wmemstream.c,v 1.8 2015/09/12 16:23:14 guenther Exp $ */
/* $OpenBSD: open_wmemstream.c,v 1.10 2023/07/11 12:14:16 claudio Exp $ */
/*
* Copyright (c) 2011 Martin Pieuchot <mpi@openbsd.org>
@ -52,10 +52,9 @@ wmemstream_write(void *v, const char *b, int l)
if (sz < end + 1)
sz = end + 1;
p = reallocarray(st->string, sz, sizeof(wchar_t));
p = recallocarray(st->string, st->size, sz, sizeof(wchar_t));
if (!p)
return (-1);
bzero(p + st->size, (sz - st->size) * sizeof(wchar_t));
*st->pbuf = st->string = p;
st->size = sz;
}
@ -146,7 +145,6 @@ open_wmemstream(wchar_t **pbuf, size_t *psize)
return (NULL);
}
*st->string = L'\0';
st->pos = 0;
st->len = 0;
st->pbuf = pbuf;