The NetBSD Project

CVS log for src/lib/libc/stdlib/reallocarr.c

[BACK] Up to [] / src / lib / libc / stdlib

Request diff between arbitrary revisions

Default branch: MAIN
Current tag: MAIN

Revision 1.5 / (download) - annotate - [select for diffs], Thu Aug 20 22:27:49 2015 UTC (7 years, 9 months ago) by kamil
Branch: MAIN
CVS Tags: prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, phil-wifi-base, phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406, phil-wifi-20191119, phil-wifi-20190609, phil-wifi, pgoyette-localcount-base, pgoyette-localcount-20170426, pgoyette-localcount-20170320, pgoyette-localcount-20170107, pgoyette-localcount-20161104, pgoyette-localcount-20160806, pgoyette-localcount-20160726, pgoyette-localcount, pgoyette-compat-merge-20190127, pgoyette-compat-base, pgoyette-compat-20190127, pgoyette-compat-20190118, pgoyette-compat-1226, pgoyette-compat-1126, pgoyette-compat-1020, pgoyette-compat-0930, pgoyette-compat-0906, pgoyette-compat-0728, pgoyette-compat-0625, pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315, pgoyette-compat, perseant-stdc-iso10646-base, perseant-stdc-iso10646, netbsd-9-base, netbsd-9-3-RELEASE, netbsd-9-2-RELEASE, netbsd-9-1-RELEASE, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1, netbsd-9, netbsd-8-base, netbsd-8-2-RELEASE, netbsd-8-1-RELEASE, netbsd-8-1-RC1, netbsd-8-0-RELEASE, netbsd-8-0-RC2, netbsd-8-0-RC1, netbsd-8, netbsd-10-base, netbsd-10, matt-nb8-mediatek-base, matt-nb8-mediatek, localcount-20160914, is-mlppp-base, is-mlppp, cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x, bouyer-socketcan-base1, bouyer-socketcan-base, bouyer-socketcan, HEAD
Changes since 1.4: +11 -5 lines
Diff to previous 1.4 (colored)

Minor alterations to reallocarr(3)

Add comment about division.
Mark error branches with __predict_false().
Reduce one branch with the OR trick.

Revision 1.4 / (download) - annotate - [select for diffs], Thu Aug 20 20:08:04 2015 UTC (7 years, 9 months ago) by joerg
Branch: MAIN
Changes since 1.3: +3 -3 lines
Diff to previous 1.3 (colored)

Fix portability.

Revision 1.3 / (download) - annotate - [select for diffs], Tue Jul 28 17:13:34 2015 UTC (7 years, 10 months ago) by kamil
Branch: MAIN
Changes since 1.2: +19 -8 lines
Diff to previous 1.2 (colored)

Compatibility fixes in reallocarr(3)

Make this work on !NetBSD platforms:
- replace __CTASSERT() with platform agnostic solution SQRT_SIZE_MAX
- include nbtool_config.h for cross builds to get definition of __RCSID()
- restore errno in the last rare code path for platforms affecting errno(2)
  in memcpy(2)

While there: rename parameter name 'num' to 'number' to be in sync with
the calloc(3) parameter naming.

Reported by scole_mail at the current-users ml.

Revision 1.2 / (download) - annotate - [select for diffs], Thu Jul 16 00:03:59 2015 UTC (7 years, 10 months ago) by kamil
Branch: MAIN
Changes since 1.1: +3 -3 lines
Diff to previous 1.1 (colored)

Reorder memcpy(3) and save errno

This change is for safety as memcpy(3) might change it.

Approved by <riastradh>

Revision 1.1 / (download) - annotate - [select for diffs], Tue Feb 17 20:29:21 2015 UTC (8 years, 3 months ago) by joerg
Branch: MAIN

Introduce reallocarr(3) for easy (re)allocation of memory with overflow
checks. Compared to OpenBSD's reallocarray, makes it easier to avoid memory
leaks on allocation failures and it doesn't depend on malloc(0) != NULL
for correct error checking. Compared to plain realloc, it also avoids
the problem of intermediate integer overflows. The trade-off is the use
of void * to side step C type system with regard to generic pointer to

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.

CVSweb <>