diff options
| author | root | 2013-08-12 12:27:22 +0200 |
|---|---|---|
| committer | root | 2013-08-12 12:27:22 +0200 |
| commit | c39e73975f7371a6458cd63967d39ba77a1e871a (patch) | |
| tree | 145fb3d8489ecd65ac6b1887e17a204bff751286 /src/alloc.c | |
| parent | 2427b15992fe47646a2bf2b55891f1e482dedaa0 (diff) | |
| parent | 6edea0a595d292c4d3f1a7e862195be07c874e40 (diff) | |
| download | emacs-c39e73975f7371a6458cd63967d39ba77a1e871a.tar.gz emacs-c39e73975f7371a6458cd63967d39ba77a1e871a.zip | |
merge from trunk
Conflicts:
src/Makefile.in
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/src/alloc.c b/src/alloc.c index 4c924f72384..2c2232601cb 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -796,10 +796,10 @@ xpalloc (void *pa, ptrdiff_t *nitems, ptrdiff_t nitems_incr_min, | |||
| 796 | char * | 796 | char * |
| 797 | xstrdup (const char *s) | 797 | xstrdup (const char *s) |
| 798 | { | 798 | { |
| 799 | size_t len = strlen (s) + 1; | 799 | ptrdiff_t size; |
| 800 | char *p = xmalloc (len); | 800 | eassert (s); |
| 801 | memcpy (p, s, len); | 801 | size = strlen (s) + 1; |
| 802 | return p; | 802 | return memcpy (xmalloc (size), s, size); |
| 803 | } | 803 | } |
| 804 | 804 | ||
| 805 | /* Like putenv, but (1) use the equivalent of xmalloc and (2) the | 805 | /* Like putenv, but (1) use the equivalent of xmalloc and (2) the |
| @@ -3371,7 +3371,7 @@ make_save_obj_obj_obj_obj (Lisp_Object a, Lisp_Object b, Lisp_Object c, | |||
| 3371 | return val; | 3371 | return val; |
| 3372 | } | 3372 | } |
| 3373 | 3373 | ||
| 3374 | #if defined HAVE_NS || defined DOS_NT | 3374 | #if defined HAVE_NS || defined HAVE_NTGUI |
| 3375 | Lisp_Object | 3375 | Lisp_Object |
| 3376 | make_save_ptr (void *a) | 3376 | make_save_ptr (void *a) |
| 3377 | { | 3377 | { |
| @@ -3394,6 +3394,19 @@ make_save_ptr_int (void *a, ptrdiff_t b) | |||
| 3394 | return val; | 3394 | return val; |
| 3395 | } | 3395 | } |
| 3396 | 3396 | ||
| 3397 | #if defined HAVE_MENUS && ! (defined USE_X_TOOLKIT || defined USE_GTK) | ||
| 3398 | Lisp_Object | ||
| 3399 | make_save_ptr_ptr (void *a, void *b) | ||
| 3400 | { | ||
| 3401 | Lisp_Object val = allocate_misc (Lisp_Misc_Save_Value); | ||
| 3402 | struct Lisp_Save_Value *p = XSAVE_VALUE (val); | ||
| 3403 | p->save_type = SAVE_TYPE_PTR_PTR; | ||
| 3404 | p->data[0].pointer = a; | ||
| 3405 | p->data[1].pointer = b; | ||
| 3406 | return val; | ||
| 3407 | } | ||
| 3408 | #endif | ||
| 3409 | |||
| 3397 | Lisp_Object | 3410 | Lisp_Object |
| 3398 | make_save_funcptr_ptr_obj (void (*a) (void), void *b, Lisp_Object c) | 3411 | make_save_funcptr_ptr_obj (void (*a) (void), void *b, Lisp_Object c) |
| 3399 | { | 3412 | { |
| @@ -4045,7 +4058,7 @@ live_string_p (struct mem_node *m, void *p) | |||
| 4045 | { | 4058 | { |
| 4046 | if (m->type == MEM_TYPE_STRING) | 4059 | if (m->type == MEM_TYPE_STRING) |
| 4047 | { | 4060 | { |
| 4048 | struct string_block *b = (struct string_block *) m->start; | 4061 | struct string_block *b = m->start; |
| 4049 | ptrdiff_t offset = (char *) p - (char *) &b->strings[0]; | 4062 | ptrdiff_t offset = (char *) p - (char *) &b->strings[0]; |
| 4050 | 4063 | ||
| 4051 | /* P must point to the start of a Lisp_String structure, and it | 4064 | /* P must point to the start of a Lisp_String structure, and it |
| @@ -4068,7 +4081,7 @@ live_cons_p (struct mem_node *m, void *p) | |||
| 4068 | { | 4081 | { |
| 4069 | if (m->type == MEM_TYPE_CONS) | 4082 | if (m->type == MEM_TYPE_CONS) |
| 4070 | { | 4083 | { |
| 4071 | struct cons_block *b = (struct cons_block *) m->start; | 4084 | struct cons_block *b = m->start; |
| 4072 | ptrdiff_t offset = (char *) p - (char *) &b->conses[0]; | 4085 | ptrdiff_t offset = (char *) p - (char *) &b->conses[0]; |
| 4073 | 4086 | ||
| 4074 | /* P must point to the start of a Lisp_Cons, not be | 4087 | /* P must point to the start of a Lisp_Cons, not be |
| @@ -4094,7 +4107,7 @@ live_symbol_p (struct mem_node *m, void *p) | |||
| 4094 | { | 4107 | { |
| 4095 | if (m->type == MEM_TYPE_SYMBOL) | 4108 | if (m->type == MEM_TYPE_SYMBOL) |
| 4096 | { | 4109 | { |
| 4097 | struct symbol_block *b = (struct symbol_block *) m->start; | 4110 | struct symbol_block *b = m->start; |
| 4098 | ptrdiff_t offset = (char *) p - (char *) &b->symbols[0]; | 4111 | ptrdiff_t offset = (char *) p - (char *) &b->symbols[0]; |
| 4099 | 4112 | ||
| 4100 | /* P must point to the start of a Lisp_Symbol, not be | 4113 | /* P must point to the start of a Lisp_Symbol, not be |
| @@ -4120,7 +4133,7 @@ live_float_p (struct mem_node *m, void *p) | |||
| 4120 | { | 4133 | { |
| 4121 | if (m->type == MEM_TYPE_FLOAT) | 4134 | if (m->type == MEM_TYPE_FLOAT) |
| 4122 | { | 4135 | { |
| 4123 | struct float_block *b = (struct float_block *) m->start; | 4136 | struct float_block *b = m->start; |
| 4124 | ptrdiff_t offset = (char *) p - (char *) &b->floats[0]; | 4137 | ptrdiff_t offset = (char *) p - (char *) &b->floats[0]; |
| 4125 | 4138 | ||
| 4126 | /* P must point to the start of a Lisp_Float and not be | 4139 | /* P must point to the start of a Lisp_Float and not be |
| @@ -4144,7 +4157,7 @@ live_misc_p (struct mem_node *m, void *p) | |||
| 4144 | { | 4157 | { |
| 4145 | if (m->type == MEM_TYPE_MISC) | 4158 | if (m->type == MEM_TYPE_MISC) |
| 4146 | { | 4159 | { |
| 4147 | struct marker_block *b = (struct marker_block *) m->start; | 4160 | struct marker_block *b = m->start; |
| 4148 | ptrdiff_t offset = (char *) p - (char *) &b->markers[0]; | 4161 | ptrdiff_t offset = (char *) p - (char *) &b->markers[0]; |
| 4149 | 4162 | ||
| 4150 | /* P must point to the start of a Lisp_Misc, not be | 4163 | /* P must point to the start of a Lisp_Misc, not be |
| @@ -4171,7 +4184,7 @@ live_vector_p (struct mem_node *m, void *p) | |||
| 4171 | if (m->type == MEM_TYPE_VECTOR_BLOCK) | 4184 | if (m->type == MEM_TYPE_VECTOR_BLOCK) |
| 4172 | { | 4185 | { |
| 4173 | /* This memory node corresponds to a vector block. */ | 4186 | /* This memory node corresponds to a vector block. */ |
| 4174 | struct vector_block *block = (struct vector_block *) m->start; | 4187 | struct vector_block *block = m->start; |
| 4175 | struct Lisp_Vector *vector = (struct Lisp_Vector *) block->data; | 4188 | struct Lisp_Vector *vector = (struct Lisp_Vector *) block->data; |
| 4176 | 4189 | ||
| 4177 | /* P is in the block's allocation range. Scan the block | 4190 | /* P is in the block's allocation range. Scan the block |