revise the definition of multiple basic locks in the code
authorJens Gustedt <Jens.Gustedt@inria.fr>
Wed, 3 Jan 2018 13:17:12 +0000 (14:17 +0100)
committerRich Felker <dalias@aerifal.cx>
Tue, 9 Jan 2018 18:15:27 +0000 (13:15 -0500)
In all cases this is just a change from two volatile int to one.

15 files changed:
src/dirent/__dirent.h
src/exit/at_quick_exit.c
src/exit/atexit.c
src/internal/pthread_impl.h
src/locale/dcngettext.c
src/locale/locale_map.c
src/locale/setlocale.c
src/malloc/lite_malloc.c
src/misc/syslog.c
src/prng/random.c
src/stdio/ofl.c
src/thread/pthread_atfork.c
src/thread/sem_open.c
src/thread/synccall.c
src/time/__tz.c

index 32871baf51a1f38cbd4a97d034de3dab9f69ff51..101b036838baab73f4b6d0cb67773b288f978209 100644 (file)
@@ -4,6 +4,6 @@ struct __dirstream
        off_t tell;
        int buf_pos;
        int buf_end;
-       volatile int lock[2];
+       volatile int lock[1];
        char buf[2048];
 };
index ac28dfd93a9f23f41f2b20a5ce741fe29113d464..4079b242cf7dc40b550208f28b7a52d2390dd99f 100644 (file)
@@ -5,7 +5,7 @@
 
 static void (*funcs[COUNT])(void);
 static int count;
-static volatile int lock[2];
+static volatile int lock[1];
 
 void __funcs_on_quick_exit()
 {
index 2b58b8bbf7416ad378f0068553417f9c50ff9c3f..cd3b0a648399f57f820abde2fecfdfece7a020e4 100644 (file)
@@ -13,7 +13,7 @@ static struct fl
 } builtin, *head;
 
 static int slot;
-static volatile int lock[2];
+static volatile int lock[1];
 
 void __funcs_on_exit()
 {
index 602d6f56a546df2e8fc0889ac01afee1186ae148..f0b2c20ca2ed4cd80ec5c6443fb3aa070baeb95c 100644 (file)
@@ -39,8 +39,8 @@ struct pthread {
        int unblock_cancel;
        volatile int timer_id;
        locale_t locale;
-       volatile int killlock[2];
-       volatile int exitlock[2];
+       volatile int killlock[1];
+       volatile int exitlock[1];
        volatile int startlock[2];
        unsigned long sigmask[_NSIG/8/sizeof(long)];
        char *dlerror_buf;
index b79b70103d1a28e95919c4a6dc7b2aa32491ba4c..d8af96037119455d78aaab72d8227d518e2b3764 100644 (file)
@@ -34,7 +34,7 @@ static char *gettextdir(const char *domainname, size_t *dirlen)
 
 char *bindtextdomain(const char *domainname, const char *dirname)
 {
-       static volatile int lock[2];
+       static volatile int lock[1];
        struct binding *p, *q;
 
        if (!domainname) return 0;
index 188fcf394ed29961d62abcc84c39c979daac1e6c..79542310c2baea04977e637bcc917332e7e30498 100644 (file)
@@ -26,7 +26,7 @@ static const char envvars[][12] = {
 
 const struct __locale_map *__get_locale(int cat, const char *val)
 {
-       static volatile int lock[2];
+       static volatile int lock[1];
        static void *volatile loc_head;
        const struct __locale_map *p;
        struct __locale_map *new = 0;
index 623660cc419347b5f71b3929561e37a664eec6cd..40bc7ece16503b036d5683f71ec09cf8e6322229 100644 (file)
@@ -21,7 +21,7 @@ char *__strchrnul(const char *, int);
 
 char *setlocale(int cat, const char *name)
 {
-       static volatile int lock[2];
+       static volatile int lock[1];
 
        if ((unsigned)cat > LC_ALL) return 0;
 
index a7e4a9f7b511bdbf2db4d5018e5088c19ed38570..701f60b4a60d4442490ae7258627b59802bf9d04 100644 (file)
@@ -11,7 +11,7 @@ void *__expand_heap(size_t *);
 static void *__simple_malloc(size_t n)
 {
        static char *cur, *end;
-       static volatile int lock[2];
+       static volatile int lock[1];
        size_t align=1, pad;
        void *p;
 
index 9dd1ddb5889322ed69099b008e384cee47b89d4d..60e9020f797824c99205308e63485d0a5a621c02 100644 (file)
@@ -11,7 +11,7 @@
 #include <fcntl.h>
 #include "libc.h"
 
-static volatile int lock[2];
+static volatile int lock[1];
 static char log_ident[32];
 static int log_opt;
 static int log_facility = LOG_USER;
index 7d557d700de027291017046230a0506f8af7842e..13a5e6df5f650d12802c589f0e5f49122a870625 100644 (file)
@@ -22,7 +22,7 @@ static int n = 31;
 static int i = 3;
 static int j = 0;
 static uint32_t *x = init+1;
-static volatile int lock[2];
+static volatile int lock[1];
 
 static uint32_t lcg31(uint32_t x) {
        return (1103515245*x + 12345) & 0x7fffffff;
index b143999c278a6dc558d7ea766578a7cfae4b32f7..0e3602aa58e4dc2639d2075266b9da89a75751c1 100644 (file)
@@ -2,7 +2,7 @@
 #include "libc.h"
 
 static FILE *ofl_head;
-static volatile int ofl_lock[2];
+static volatile int ofl_lock[1];
 
 FILE **__ofl_lock()
 {
index a40d7f63287079c2ce538360305b86e7174b06e9..c6f77b3f4fe73c626f9a1ee3ae5b2daa0175a424 100644 (file)
@@ -8,7 +8,7 @@ static struct atfork_funcs {
        struct atfork_funcs *prev, *next;
 } *funcs;
 
-static volatile int lock[2];
+static volatile int lock[1];
 
 void __fork_handler(int who)
 {
index fda0acd35c717992e44b4c5191e6f400d1190532..dc0279e8a7003e0a51b4648e1ce94c7bdb75a2ff 100644 (file)
@@ -20,7 +20,7 @@ static struct {
        sem_t *sem;
        int refcnt;
 } *semtab;
-static volatile int lock[2];
+static volatile int lock[1];
 
 #define FLAGS (O_RDWR|O_NOFOLLOW|O_CLOEXEC|O_NONBLOCK)
 
index f681357635f3c765ee44701f4c2375439c610e12..ba2f258e8161962a63a4f53a82ff3be04b0669e7 100644 (file)
@@ -14,7 +14,7 @@ static struct chain {
        sem_t target_sem, caller_sem;
 } *volatile head;
 
-static volatile int synccall_lock[2];
+static volatile int synccall_lock[1];
 static volatile int target_tid;
 static void (*callback)(void *), *context;
 static volatile int dummy = 0;
index 8cc96032ba38dfae88a6d47211f3595312e26150..1dbb0b8ffd428bc520f1054e98206611a5734a5c 100644 (file)
@@ -27,7 +27,7 @@ static char old_tz_buf[32];
 static char *old_tz = old_tz_buf;
 static size_t old_tz_size = sizeof old_tz_buf;
 
-static volatile int lock[2];
+static volatile int lock[1];
 
 static int getint(const char **p)
 {