projects
/
chise
/
xemacs-chise.git-
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add glyph-images of HNG-KHI.
[chise/xemacs-chise.git-]
/
src
/
dynarr.c
diff --git
a/src/dynarr.c
b/src/dynarr.c
index
02f4343
..
5dfc79d
100644
(file)
--- a/
src/dynarr.c
+++ b/
src/dynarr.c
@@
-101,15
+101,14
@@
Use the following functions/macros:
Use the following global variable:
Dynarr_min_size
Use the following global variable:
Dynarr_min_size
- Minimum allowable size for a dynamic array when it is resized. The
- default is 32 and does not normally need to be changed.
+ Minimum allowable size for a dynamic array when it is resized.
*/
#include <config.h>
#include "lisp.h"
*/
#include <config.h>
#include "lisp.h"
-int Dynarr_min_size = 1;
+static int Dynarr_min_size = 8;
static void
Dynarr_realloc (Dynarr *dy, int new_size)
static void
Dynarr_realloc (Dynarr *dy, int new_size)
@@
-117,7
+116,8
@@
Dynarr_realloc (Dynarr *dy, int new_size)
if (DUMPEDP (dy->base))
{
void *new_base = malloc (new_size);
if (DUMPEDP (dy->base))
{
void *new_base = malloc (new_size);
- memcpy (new_base, dy->base, dy->max > new_size ? new_size : dy->max);
+ int max_bytes = dy->max * dy->elsize;
+ memcpy (new_base, dy->base, max_bytes > new_size ? new_size : max_bytes);
dy->base = new_base;
}
else
dy->base = new_base;
}
else
@@
-158,7
+158,7
@@
Dynarr_resize (void *d, int size)
/* Add a number of contiguous elements to the array starting at START. */
void
/* Add a number of contiguous elements to the array starting at START. */
void
-Dynarr_insert_many (void *d, CONST void *el, int len, int start)
+Dynarr_insert_many (void *d, const void *el, int len, int start)
{
Dynarr *dy = (Dynarr *) d;
{
Dynarr *dy = (Dynarr *) d;