Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/db/recno fix bug in previous change (sz should be t...
details: https://anonhg.NetBSD.org/src/rev/c3f7aac06418
branches: trunk
changeset: 325456:c3f7aac06418
user: christos <christos%NetBSD.org@localhost>
date: Wed Dec 25 19:42:23 2013 +0000
description:
fix bug in previous change (sz should be the size of the newly allocated
buffer).
diffstat:
lib/libc/db/recno/rec_get.c | 14 ++++++--------
1 files changed, 6 insertions(+), 8 deletions(-)
diffs (44 lines):
diff -r b7d08d1ced98 -r c3f7aac06418 lib/libc/db/recno/rec_get.c
--- a/lib/libc/db/recno/rec_get.c Wed Dec 25 17:24:39 2013 +0000
+++ b/lib/libc/db/recno/rec_get.c Wed Dec 25 19:42:23 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rec_get.c,v 1.17 2013/12/14 18:04:56 christos Exp $ */
+/* $NetBSD: rec_get.c,v 1.18 2013/12/25 19:42:23 christos Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@@ -34,7 +34,7 @@
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: rec_get.c,v 1.17 2013/12/14 18:04:56 christos Exp $");
+__RCSID("$NetBSD: rec_get.c,v 1.18 2013/12/25 19:42:23 christos Exp $");
#include "namespace.h"
#include <sys/types.h>
@@ -175,7 +175,6 @@
{
DBT data;
recno_t nrec;
- ptrdiff_t len;
size_t sz;
int bval, ch;
uint8_t *p;
@@ -195,13 +194,12 @@
break;
}
if (sz == 0) {
- void *np;
- len = p - (uint8_t *)t->bt_rdata.data;
- sz = t->bt_rdata.size + 256;
- np = realloc(t->bt_rdata.data, sz);
+ ptrdiff_t len = p - (uint8_t *)t->bt_rdata.data;
+ size_t tot = t->bt_rdata.size + (sz = 256);
+ void *np = realloc(t->bt_rdata.data, tot);
if (np == NULL)
return (RET_ERROR);
- t->bt_rdata.size = sz;
+ t->bt_rdata.size = tot;
t->bt_rdata.data = np;
p = (uint8_t *)t->bt_rdata.data + len;
}
Home |
Main Index |
Thread Index |
Old Index