[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
update fatal-signal module
From: |
Bruno Haible |
Subject: |
update fatal-signal module |
Date: |
Sat, 22 Jul 2006 16:42:12 +0200 |
User-agent: |
KMail/1.9.1 |
Merge from gettext. This is related to the fact that the compiler
can inline 'memcpy' calls and then reorder instructions, if we don't
write 'volatile'...
2006-04-09 Bruno Haible <address@hidden>
* fatal-signal.c: Don't include string.h.
(at_fatal_signal): Use a copying loop instead of memcpy.
*** fatal-signal.c 24 Apr 2006 11:38:06 -0000 1.7
--- fatal-signal.c 22 Jul 2006 14:42:13 -0000
***************
*** 27,33 ****
#include <stdbool.h>
#include <stdlib.h>
#include <signal.h>
- #include <string.h>
#include <unistd.h>
#include "xalloc.h"
--- 27,32 ----
***************
*** 201,212 ****
because then the cleanup() function could access an already
deallocated array. */
actions_entry_t *old_actions = actions;
size_t new_actions_allocated = 2 * actions_allocated;
actions_entry_t *new_actions =
xmalloc (new_actions_allocated * sizeof (actions_entry_t));
! memcpy (new_actions, old_actions,
! actions_allocated * sizeof (actions_entry_t));
actions = new_actions;
actions_allocated = new_actions_allocated;
/* Now we can free the old actions array. */
--- 200,216 ----
because then the cleanup() function could access an already
deallocated array. */
actions_entry_t *old_actions = actions;
+ size_t old_actions_allocated = actions_allocated;
size_t new_actions_allocated = 2 * actions_allocated;
actions_entry_t *new_actions =
xmalloc (new_actions_allocated * sizeof (actions_entry_t));
+ size_t k;
! /* Don't use memcpy() here, because memcpy takes non-volatile arguments
! and is therefore not guaranteed to complete all memory stores before
! the next statement. */
! for (k = 0; k < old_actions_allocated; k++)
! new_actions[k] = old_actions[k];
actions = new_actions;
actions_allocated = new_actions_allocated;
/* Now we can free the old actions array. */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- update fatal-signal module,
Bruno Haible <=