Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 943854
Collapse All | Expand All

(-)a/baselib/src/bl_map.c (+1 lines)
Lines 2-7 Link Here
2
2
3
#include "bl_map.h"
3
#include "bl_map.h"
4
4
5
#include <strings.h> /* strcasecmp */
5
#include <string.h> /* strcmp */
6
#include <string.h> /* strcmp */
6
7
7
#include "bl_util.h" /* BL_ARRAY_SIZE */
8
#include "bl_util.h" /* BL_ARRAY_SIZE */
(-)a/baselib/src/bl_map.h (+82 lines)
Lines 114-119 Link Here
114
114
115
#endif
115
#endif
116
116
117
#if __STDC_VERSION__ <= 201710L
117
#define bl_map_set(result, map, __key, __value)                                                \
118
#define bl_map_set(result, map, __key, __value)                                                \
118
  {                                                                                            \
119
  {                                                                                            \
119
    int __hash_key;                                                                            \
120
    int __hash_key;                                                                            \
Lines 193-198 Link Here
193
      __hash_key = bl_map_rehash(__hash_key, (map)->map_size);                                 \
194
      __hash_key = bl_map_rehash(__hash_key, (map)->map_size);                                 \
194
    }                                                                                          \
195
    }                                                                                          \
195
  }
196
  }
197
#else /* horrors of C23 and macro expansions */
198
#define bl_map_set(result, map, __key, __value)                                                \
199
  {                                                                                            \
200
    int __hash_key;                                                                            \
201
    u_int __count;                                                                             \
202
                                                                                               \
203
    result = 0;                                                                                \
204
                                                                                               \
205
    if ((map)->map_size == (map)->filled_size + MAP_MARGIN_SIZE) {                             \
206
      /*                                                                                       \
207
       * Expanding map by DEFAULT_MAP_SIZE                                                     \
208
       */                                                                                      \
209
                                                                                               \
210
      u_int __new_size;                                                                        \
211
      void* __new;                                                                             \
212
                                                                                               \
213
      __new_size = (map)->map_size + DEFAULT_MAP_SIZE;                                         \
214
                                                                                               \
215
      bl_map_dump_size((map)->map_size, __new_size);                                           \
216
                                                                                               \
217
      if ((__new = calloc(__new_size, sizeof(*(map)->pairs)))) {                               \
218
        void* __old;                                                                           \
219
                                                                                               \
220
        __old = (map)->pairs;                                                                  \
221
                                                                                               \
222
        if ((int (*)(int, u_int))(map)->hash_func == bl_map_hash_int ||                        \
223
            (int (*)(int, u_int))(map)->hash_func == bl_map_hash_int_fast) {                   \
224
          if (__new_size & (__new_size - 1)) {                                                 \
225
            /* XXX int (*)() should be int (*)(key_type, u_int) */                             \
226
            (map)->hash_func = (typeof((map)->hash_func))bl_map_hash_int;                      \
227
          } else {                                                                             \
228
            /* __new_size == 2^n */                                                            \
229
            /* XXX int (*)() should be int (*)(key_type, u_int) */                             \
230
            (map)->hash_func = (typeof((map)->hash_func))bl_map_hash_int_fast;                 \
231
          }                                                                                    \
232
        }                                                                                      \
233
                                                                                               \
234
        /* reconstruct (map)->pairs since map_size is changed. */                              \
235
        for (__count = 0; __count < (map)->map_size; __count++) {                              \
236
          if ((map)->pairs[__count].is_filled) {                                               \
237
            void *dst;                                                                         \
238
                                                                                               \
239
            __hash_key = (*(map)->hash_func)((map)->pairs[__count].key, __new_size);           \
240
                                                                                               \
241
            (map)->pairs = __new;                                                              \
242
            while ((map)->pairs[__hash_key].is_filled) {                                       \
243
              __hash_key = bl_map_rehash(__hash_key, __new_size);                              \
244
            }                                                                                  \
245
                                                                                               \
246
            dst = &(map)->pairs[__hash_key];                                                   \
247
            (map)->pairs = __old;                                                              \
248
            memcpy(dst, &(map)->pairs[__count], sizeof(*(map)->pairs));                        \
249
          }                                                                                    \
250
        }                                                                                      \
251
                                                                                               \
252
        free(__old);                                                                           \
253
        (map)->pairs = __new;                                                                  \
254
        (map)->map_size = __new_size;                                                          \
255
      }                                                                                        \
256
    }                                                                                          \
257
                                                                                               \
258
    __hash_key = (*(map)->hash_func)(__key, (map)->map_size);                                  \
259
    for (__count = 0; __count < (map)->map_size; __count++) {                                  \
260
      if (!(map)->pairs[__hash_key].is_filled) {                                               \
261
        (map)->pairs[__hash_key].key = __key;                                                  \
262
        (map)->pairs[__hash_key].value = __value;                                              \
263
        (map)->pairs[__hash_key].is_filled = 1;                                                \
264
        (map)->filled_size++;                                                                  \
265
                                                                                               \
266
        free((map)->pairs_array);                                                              \
267
        (map)->pairs_array = NULL;                                                             \
268
                                                                                               \
269
        result = 1;                                                                            \
270
                                                                                               \
271
        break;                                                                                 \
272
      }                                                                                        \
273
                                                                                               \
274
      __hash_key = bl_map_rehash(__hash_key, (map)->map_size);                                 \
275
    }                                                                                          \
276
  }
277
#endif
196
278
197
#define __bl_map_erase_simple(result, map, __key)                      \
279
#define __bl_map_erase_simple(result, map, __key)                      \
198
  int __hash_key;                                                      \
280
  int __hash_key;                                                      \
(-)a/baselib/src/bl_privilege.c (+2 lines)
Lines 1-5 Link Here
1
/* -*- c-basic-offset:2; tab-width:2; indent-tabs-mode:nil -*- */
1
/* -*- c-basic-offset:2; tab-width:2; indent-tabs-mode:nil -*- */
2
2
3
#define _POSIX_C_SOURCE 200809L
4
3
#include "bl_privilege.h"
5
#include "bl_privilege.h"
4
6
5
#include <unistd.h> /* getuid/getgid */
7
#include <unistd.h> /* getuid/getgid */
(-)a/baselib/src/bl_str.h (-1 / +4 lines)
Lines 9-16 Link Here
9
#include "bl_def.h"
9
#include "bl_def.h"
10
#include "bl_mem.h" /* alloca */
10
#include "bl_mem.h" /* alloca */
11
11
12
#ifdef HAVE_STRSEP
12
#if __STDC_VERSION__ > 201710L /*there's weird problem with strsep imclusion and C23 */
13
#undef HAVE_STRSEP
14
#endif
13
15
16
#ifdef HAVE_STRSEP
14
#define bl_str_sep(strp, delim) strsep(strp, delim)
17
#define bl_str_sep(strp, delim) strsep(strp, delim)
15
18
16
#else
19
#else
(-)a/common/c_imagelib.c (+1 lines)
Lines 2-7 Link Here
2
2
3
#ifdef BUILTIN_IMAGELIB
3
#ifdef BUILTIN_IMAGELIB
4
4
5
#include <strings.h>      /* strcasecmp */
5
#include <pobl/bl_util.h> /* DIGIT_STR_LEN */
6
#include <pobl/bl_util.h> /* DIGIT_STR_LEN */
6
#include <pobl/bl_mem.h>  /* alloca */
7
#include <pobl/bl_mem.h>  /* alloca */
7
#include <pobl/bl_path.h> /* BL_LIBEXECDIR (for registobmp) */
8
#include <pobl/bl_path.h> /* BL_LIBEXECDIR (for registobmp) */
(-)a/encodefilter/src/ef_xct_conv.c (-1 / +2 lines)
Lines 2-8 Link Here
2
2
3
#include "ef_xct_conv.h"
3
#include "ef_xct_conv.h"
4
4
5
#include <string.h> /* strcasecmp */
5
#include <strings.h> /* strcasecmp */
6
#include <string.h> /* strlen/memcpy */
6
#include <pobl/bl_mem.h>
7
#include <pobl/bl_mem.h>
7
#include <pobl/bl_locale.h> /* bl_get_codeset() */
8
#include <pobl/bl_locale.h> /* bl_get_codeset() */
8
#include <pobl/bl_debug.h>
9
#include <pobl/bl_debug.h>
(-)a/libind/lex.split.c (+1 lines)
Lines 28-33 Link Here
28
#define YY_FLEX_MAJOR_VERSION 2
28
#define YY_FLEX_MAJOR_VERSION 2
29
#define YY_FLEX_MINOR_VERSION 5
29
#define YY_FLEX_MINOR_VERSION 5
30
30
31
#define _GNU_SOURCE /* fileno */
31
#include <stdio.h>
32
#include <stdio.h>
32
33
33
/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
34
/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
(-)a/uitoolkit/libtype/ui_font_ft.c (+1 lines)
Lines 2-7 Link Here
2
2
3
#include "../ui_font.h"
3
#include "../ui_font.h"
4
4
5
#include <strings.h> /* strcasecmp */
5
#include <stdlib.h> /* strtod */
6
#include <stdlib.h> /* strtod */
6
#ifdef USE_TYPE_XFT
7
#ifdef USE_TYPE_XFT
7
#include <X11/Xft/Xft.h>
8
#include <X11/Xft/Xft.h>
(-)a/uitoolkit/ui_emoji.c (+1 lines)
Lines 1-5 Link Here
1
/* -*- c-basic-offset:2; tab-width:2; indent-tabs-mode:nil -*- */
1
/* -*- c-basic-offset:2; tab-width:2; indent-tabs-mode:nil -*- */
2
2
3
#define _GNU_SOURCE
3
#include "ui_emoji.h"
4
#include "ui_emoji.h"
4
5
5
#include <stdio.h>
6
#include <stdio.h>
(-)a/uitoolkit/ui_main_config.h (+1 lines)
Lines 3-8 Link Here
3
#ifndef __UI_MAIN_CONFIG_H__
3
#ifndef __UI_MAIN_CONFIG_H__
4
#define __UI_MAIN_CONFIG_H__
4
#define __UI_MAIN_CONFIG_H__
5
5
6
#define _POSIX_C_SOURCE 200809L
6
#include <pobl/bl_types.h>
7
#include <pobl/bl_types.h>
7
#include <pobl/bl_conf.h>
8
#include <pobl/bl_conf.h>
8
#include <vt_term.h>
9
#include <vt_term.h>
(-)a/uitoolkit/ui_picture.c (+1 lines)
Lines 8-13 Link Here
8
#include <stdlib.h> /* system */
8
#include <stdlib.h> /* system */
9
#include <fcntl.h>
9
#include <fcntl.h>
10
#include <sys/stat.h>
10
#include <sys/stat.h>
11
#include <strings.h> /* strcasecmp */
11
12
12
#include <pobl/bl_debug.h>
13
#include <pobl/bl_debug.h>
13
#include <pobl/bl_str.h>     /* strdup */
14
#include <pobl/bl_str.h>     /* strdup */
(-)a/uitoolkit/ui_screen_manager.h (+2 lines)
Lines 3-8 Link Here
3
#ifndef __UI_SCREEN_MANAGER_H__
3
#ifndef __UI_SCREEN_MANAGER_H__
4
#define __UI_SCREEN_MANAGER_H__
4
#define __UI_SCREEN_MANAGER_H__
5
5
6
#define _GNU_SOURCE
7
#include <stdlib.h> /* putenv */
6
#include <stdio.h> /* FILE */
8
#include <stdio.h> /* FILE */
7
#include "ui_screen.h"
9
#include "ui_screen.h"
8
#include "ui_main_config.h"
10
#include "ui_main_config.h"
(-)a/uitoolkit/xlib/ui_decsp_font.h (+1 lines)
Lines 3-8 Link Here
3
#ifndef __UI_DECSP_FONT_H__
3
#ifndef __UI_DECSP_FONT_H__
4
#define __UI_DECSP_FONT_H__
4
#define __UI_DECSP_FONT_H__
5
5
6
#include <pobl/bl_def.h>
6
#include "../ui.h"
7
#include "../ui.h"
7
8
8
typedef struct ui_decsp_font {
9
typedef struct ui_decsp_font {
(-)a/vtemu/vt_char_encoding.c (+1 lines)
Lines 2-7 Link Here
2
2
3
#include "vt_char_encoding.h"
3
#include "vt_char_encoding.h"
4
4
5
#include <strings.h> /* strcasecmp */
5
#include <stdio.h> /* sscanf */
6
#include <stdio.h> /* sscanf */
6
7
7
#include <pobl/bl_str.h> /* bl_str_sep */
8
#include <pobl/bl_str.h> /* bl_str_sep */
(-)a/vtemu/vt_config_proto.c (+1 lines)
Lines 2-7 Link Here
2
2
3
#include "vt_config_proto.h"
3
#include "vt_config_proto.h"
4
4
5
#define _POSIX_C_SOURCE 200809L /* fileno */
5
#include <stdio.h>
6
#include <stdio.h>
6
#include <stdlib.h>
7
#include <stdlib.h>
7
#include <string.h>
8
#include <string.h>
(-)a/vtemu/vt_parser.c (+2 lines)
Lines 2-8 Link Here
2
2
3
#include "vt_parser.h"
3
#include "vt_parser.h"
4
4
5
#define _GNU_SOURCE   /* usleep */
5
#include <stdio.h>    /* sprintf */
6
#include <stdio.h>    /* sprintf */
7
#include <strings.h>  /* strcasecmp */
6
#include <string.h>   /* memmove */
8
#include <string.h>   /* memmove */
7
#include <stdlib.h>   /* atoi */
9
#include <stdlib.h>   /* atoi */
8
#include <fcntl.h>    /* open */
10
#include <fcntl.h>    /* open */
(-)a/vtemu/zmodem.c (+1 lines)
Lines 47-52 Link Here
47
 *
47
 *
48
 */
48
 */
49
49
50
#define _GNU_SOURCE
50
#include <stdio.h>
51
#include <stdio.h>
51
#include <stdarg.h>
52
#include <stdarg.h>
52
#include <assert.h>
53
#include <assert.h>
(-)a/configure (+1 lines)
Lines 23781-23786 Link Here
23781
_ACEOF
23781
_ACEOF
23782
if ac_fn_c_try_compile "$LINENO"; then :
23782
if ac_fn_c_try_compile "$LINENO"; then :
23783
  $as_echo "#define HAVE_GNU_SOURCE 1" >>confdefs.h
23783
  $as_echo "#define HAVE_GNU_SOURCE 1" >>confdefs.h
23784
  $as_echo "#define _GNU_SOURCE" >>confdefs.h
23784
23785
23785
fi
23786
fi
23786
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
23787
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext

Return to bug 943854