| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | #ifndef _GNU_SOURCE |
|---|
| 23 | # define _GNU_SOURCE  1 |
|---|
| 24 | #endif |
|---|
| 25 | |
|---|
| 26 | #ifdef HAVE_CONFIG_H |
|---|
| 27 | # include <config.h> |
|---|
| 28 | #endif |
|---|
| 29 | |
|---|
| 30 | #include <sys/types.h> |
|---|
| 31 | |
|---|
| 32 | #ifdef __GNUC__ |
|---|
| 33 | # define alloca __builtin_alloca |
|---|
| 34 | # define HAVE_ALLOCA 1 |
|---|
| 35 | #else |
|---|
| 36 | # ifdef _MSC_VER |
|---|
| 37 | # include <malloc.h> |
|---|
| 38 | # define alloca _alloca |
|---|
| 39 | # else |
|---|
| 40 | # if defined HAVE_ALLOCA_H || defined _LIBC |
|---|
| 41 | #  include <alloca.h> |
|---|
| 42 | #Â else |
|---|
| 43 | #  ifdef _AIX |
|---|
| 44 | Â #pragma alloca |
|---|
| 45 | #Â Â else |
|---|
| 46 | #  ifndef alloca |
|---|
| 47 | char *alloca (); |
|---|
| 48 | #Â Â endif |
|---|
| 49 | #Â Â endif |
|---|
| 50 | #Â endif |
|---|
| 51 | # endif |
|---|
| 52 | #endif |
|---|
| 53 | |
|---|
| 54 | #include <errno.h> |
|---|
| 55 | #ifndef errno |
|---|
| 56 | extern int errno; |
|---|
| 57 | #endif |
|---|
| 58 | #ifndef __set_errno |
|---|
| 59 | # define __set_errno(val) errno = (val) |
|---|
| 60 | #endif |
|---|
| 61 | |
|---|
| 62 | #include <stddef.h> |
|---|
| 63 | #include <stdlib.h> |
|---|
| 64 | #include <string.h> |
|---|
| 65 | |
|---|
| 66 | #if defined HAVE_UNISTD_H || defined _LIBC |
|---|
| 67 | # include <unistd.h> |
|---|
| 68 | #endif |
|---|
| 69 | |
|---|
| 70 | #include <locale.h> |
|---|
| 71 | |
|---|
| 72 | #ifdef _LIBC |
|---|
| 73 | Â |
|---|
| 74 | |
|---|
| 75 | # if defined __alpha__ || defined __arm__ || defined __i386__ \ |
|---|
| 76 | Â Â Â || defined __m68k__ || defined __s390__ |
|---|
| 77 | # define INTDIV0_RAISES_SIGFPE 1 |
|---|
| 78 | # else |
|---|
| 79 | # define INTDIV0_RAISES_SIGFPE 0 |
|---|
| 80 | # endif |
|---|
| 81 | #endif |
|---|
| 82 | #if !INTDIV0_RAISES_SIGFPE |
|---|
| 83 | # include <signal.h> |
|---|
| 84 | #endif |
|---|
| 85 | |
|---|
| 86 | #if defined HAVE_SYS_PARAM_H || defined _LIBC |
|---|
| 87 | # include <sys/param.h> |
|---|
| 88 | #endif |
|---|
| 89 | |
|---|
| 90 | #include "gettextP.h" |
|---|
| 91 | #include "plural-exp.h" |
|---|
| 92 | #ifdef _LIBC |
|---|
| 93 | # include <libintl.h> |
|---|
| 94 | #else |
|---|
| 95 | # include "libgnuintl.h" |
|---|
| 96 | #endif |
|---|
| 97 | #include "hash-string.h" |
|---|
| 98 | |
|---|
| 99 | |
|---|
| 100 | #ifdef _LIBC |
|---|
| 101 | # include <bits/libc-lock.h> |
|---|
| 102 | #else |
|---|
| 103 | |
|---|
| 104 | # define __libc_lock_define_initialized(CLASS, NAME) |
|---|
| 105 | # define __libc_lock_lock(NAME) |
|---|
| 106 | # define __libc_lock_unlock(NAME) |
|---|
| 107 | # define __libc_rwlock_define_initialized(CLASS, NAME) |
|---|
| 108 | # define __libc_rwlock_rdlock(NAME) |
|---|
| 109 | # define __libc_rwlock_unlock(NAME) |
|---|
| 110 | #endif |
|---|
| 111 | |
|---|
| 112 | |
|---|
| 113 | #if defined __GNUC__ && __GNUC__ >= 2 |
|---|
| 114 | # define alignof(TYPE) __alignof__ (TYPE) |
|---|
| 115 | #else |
|---|
| 116 | # define alignof(TYPE) \ |
|---|
| 117 |   ((int) &((struct { char dummy1; TYPE dummy2; } *) 0)->dummy2) |
|---|
| 118 | #endif |
|---|
| 119 | |
|---|
| 120 | |
|---|
| 121 | |
|---|
| 122 | |
|---|
| 123 | #if !defined _LIBC |
|---|
| 124 | # define _nl_default_default_domain libintl_nl_default_default_domain |
|---|
| 125 | # define _nl_current_default_domain libintl_nl_current_default_domain |
|---|
| 126 | # define _nl_default_dirname libintl_nl_default_dirname |
|---|
| 127 | # define _nl_domain_bindings libintl_nl_domain_bindings |
|---|
| 128 | #endif |
|---|
| 129 | |
|---|
| 130 | |
|---|
| 131 | #ifndef offsetof |
|---|
| 132 | # define offsetof(type,ident) ((size_t)&(((type*)0)->ident)) |
|---|
| 133 | #endif |
|---|
| 134 | |
|---|
| 135 | |
|---|
| 136 | |
|---|
| 137 | #ifdef _LIBC |
|---|
| 138 | |
|---|
| 139 | |
|---|
| 140 | |
|---|
| 141 | # define getcwd __getcwd |
|---|
| 142 | # ifndef stpcpy |
|---|
| 143 | # define stpcpy __stpcpy |
|---|
| 144 | # endif |
|---|
| 145 | # define tfind __tfind |
|---|
| 146 | #else |
|---|
| 147 | # if !defined HAVE_GETCWD |
|---|
| 148 | char *getwd (); |
|---|
| 149 | # define getcwd(buf, max) getwd (buf) |
|---|
| 150 | # else |
|---|
| 151 | # if VMS |
|---|
| 152 | #  define getcwd(buf, max) (getcwd) (buf, max, 0) |
|---|
| 153 | #Â else |
|---|
| 154 | char *getcwd (); |
|---|
| 155 | #Â endif |
|---|
| 156 | # endif |
|---|
| 157 | # ifndef HAVE_STPCPY |
|---|
| 158 | static char *stpcpy (char *dest, const char *src); |
|---|
| 159 | # endif |
|---|
| 160 | # ifndef HAVE_MEMPCPY |
|---|
| 161 | static void *mempcpy (void *dest, const void *src, size_t n); |
|---|
| 162 | # endif |
|---|
| 163 | #endif |
|---|
| 164 | |
|---|
| 165 | |
|---|
| 166 | #define PATH_INCR 32 |
|---|
| 167 | |
|---|
| 168 | |
|---|
| 169 | |
|---|
| 170 | |
|---|
| 171 | |
|---|
| 172 | #if defined _POSIX_VERSION || (defined HAVE_LIMITS_H && !defined __GNUC__) |
|---|
| 173 | # include <limits.h> |
|---|
| 174 | #endif |
|---|
| 175 | |
|---|
| 176 | #ifndef _POSIX_PATH_MAX |
|---|
| 177 | # define _POSIX_PATH_MAX 255 |
|---|
| 178 | #endif |
|---|
| 179 | |
|---|
| 180 | #if !defined PATH_MAX && defined _PC_PATH_MAX |
|---|
| 181 | # define PATH_MAX (pathconf ("/", _PC_PATH_MAX) < 1 ? 1024 : pathconf ("/", _PC_PATH_MAX)) |
|---|
| 182 | #endif |
|---|
| 183 | |
|---|
| 184 | |
|---|
| 185 | #if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN |
|---|
| 186 | # include <sys/param.h> |
|---|
| 187 | #endif |
|---|
| 188 | |
|---|
| 189 | #if !defined PATH_MAX && defined MAXPATHLEN |
|---|
| 190 | # define PATH_MAX MAXPATHLEN |
|---|
| 191 | #endif |
|---|
| 192 | |
|---|
| 193 | #ifndef PATH_MAX |
|---|
| 194 | # define PATH_MAX _POSIX_PATH_MAX |
|---|
| 195 | #endif |
|---|
| 196 | |
|---|
| 197 | |
|---|
| 198 | |
|---|
| 199 | |
|---|
| 200 | |
|---|
| 201 | |
|---|
| 202 | |
|---|
| 203 | #if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__ |
|---|
| 204 | Â |
|---|
| 205 | # define ISSLASH(C) ((C) == '/' || (C) == '\\') |
|---|
| 206 | # define HAS_DEVICE(P) \ |
|---|
| 207 | Â Â ((((P)[0] >= 'A'Â && (P)[0] <= 'Z') || ((P)[0] >= 'a'Â && (P)[0] <= 'z')) \ |
|---|
| 208 | Â Â Â && (P)[1] == ':') |
|---|
| 209 | # define IS_ABSOLUTE_PATH(P) (ISSLASH ((P)[0]) || HAS_DEVICE (P)) |
|---|
| 210 | # define IS_PATH_WITH_DIR(P) \ |
|---|
| 211 | Â Â (strchr (P, '/') != NULL || strchr (P, '\\') != NULL || HAS_DEVICE (P)) |
|---|
| 212 | #else |
|---|
| 213 | Â |
|---|
| 214 | # define ISSLASH(C) ((C) == '/') |
|---|
| 215 | # define IS_ABSOLUTE_PATH(P) ISSLASH ((P)[0]) |
|---|
| 216 | # define IS_PATH_WITH_DIR(P) (strchr (P, '/') != NULL) |
|---|
| 217 | #endif |
|---|
| 218 | |
|---|
| 219 | |
|---|
| 220 | |
|---|
| 221 | struct known_translation_t |
|---|
| 222 | { |
|---|
| 223 | Â |
|---|
| 224 |  char *domainname; |
|---|
| 225 | |
|---|
| 226 | Â |
|---|
| 227 |  int category; |
|---|
| 228 | |
|---|
| 229 | Â |
|---|
| 230 |  int counter; |
|---|
| 231 | |
|---|
| 232 | Â |
|---|
| 233 |  struct loaded_l10nfile *domain; |
|---|
| 234 | |
|---|
| 235 | Â |
|---|
| 236 |  const char *translation; |
|---|
| 237 | Â size_t translation_length; |
|---|
| 238 | |
|---|
| 239 | Â |
|---|
| 240 |  char msgid[ZERO]; |
|---|
| 241 | }; |
|---|
| 242 | |
|---|
| 243 | |
|---|
| 244 | |
|---|
| 245 | #if defined HAVE_TSEARCH || defined _LIBC |
|---|
| 246 | # include <search.h> |
|---|
| 247 | |
|---|
| 248 | static void *root; |
|---|
| 249 | |
|---|
| 250 | # ifdef _LIBC |
|---|
| 251 | # define tsearch __tsearch |
|---|
| 252 | # endif |
|---|
| 253 | |
|---|
| 254 | |
|---|
| 255 | static int |
|---|
| 256 | transcmp (const void *p1, const void *p2) |
|---|
| 257 | { |
|---|
| 258 |  const struct known_translation_t *s1; |
|---|
| 259 |  const struct known_translation_t *s2; |
|---|
| 260 |  int result; |
|---|
| 261 | |
|---|
| 262 |  s1 = (const struct known_translation_t *) p1; |
|---|
| 263 |  s2 = (const struct known_translation_t *) p2; |
|---|
| 264 | |
|---|
| 265 | Â result = strcmp (s1->msgid, s2->msgid); |
|---|
| 266 |  if (result == 0) |
|---|
| 267 | Â Â { |
|---|
| 268 | Â Â Â result = strcmp (s1->domainname, s2->domainname); |
|---|
| 269 |    if (result == 0) |
|---|
| 270 | Â Â |
|---|
| 271 | |
|---|
| 272 | |
|---|
| 273 | Â Â result = s1->category - s2->category; |
|---|
| 274 | Â Â } |
|---|
| 275 | |
|---|
| 276 |  return result; |
|---|
| 277 | } |
|---|
| 278 | #endif |
|---|
| 279 | |
|---|
| 280 | #ifndef INTVARDEF |
|---|
| 281 | # define INTVARDEF(name) |
|---|
| 282 | #endif |
|---|
| 283 | #ifndef INTUSE |
|---|
| 284 | # define INTUSE(name) name |
|---|
| 285 | #endif |
|---|
| 286 | |
|---|
| 287 | |
|---|
| 288 | |
|---|
| 289 | const char _nl_default_default_domain[] attribute_hidden = "messages"; |
|---|
| 290 | |
|---|
| 291 | |
|---|
| 292 | const char *_nl_current_default_domain attribute_hidden |
|---|
| 293 | Â Â Â = _nl_default_default_domain; |
|---|
| 294 | |
|---|
| 295 | |
|---|
| 296 | #if defined __EMX__ |
|---|
| 297 | extern const char _nl_default_dirname[]; |
|---|
| 298 | #else |
|---|
| 299 | const char _nl_default_dirname[] = LOCALEDIR; |
|---|
| 300 | INTVARDEFÂ (_nl_default_dirname) |
|---|
| 301 | #endif |
|---|
| 302 | |
|---|
| 303 | |
|---|
| 304 | |
|---|
| 305 | struct binding *_nl_domain_bindings; |
|---|
| 306 | |
|---|
| 307 | |
|---|
| 308 | static char *plural_lookup (struct loaded_l10nfile *domain, |
|---|
| 309 |         unsigned long int n, |
|---|
| 310 |         const char *translation, size_t translation_len) |
|---|
| 311 | Â Â Â internal_function; |
|---|
| 312 | static const char *guess_category_value (int category, |
|---|
| 313 |            const char *categoryname) |
|---|
| 314 | Â Â Â internal_function; |
|---|
| 315 | #ifdef _LIBC |
|---|
| 316 | # include "../locale/localeinfo.h" |
|---|
| 317 | # define category_to_name(category) _nl_category_names[category] |
|---|
| 318 | #else |
|---|
| 319 | static const char *category_to_name (int category) internal_function; |
|---|
| 320 | #endif |
|---|
| 321 | |
|---|
| 322 | |
|---|
| 323 | |
|---|
| 324 | |
|---|
| 325 | #ifdef HAVE_ALLOCA |
|---|
| 326 | |
|---|
| 327 | # define freea(p) |
|---|
| 328 | # define ADD_BLOCK(list, address) |
|---|
| 329 | # define FREE_BLOCKS(list) |
|---|
| 330 | #else |
|---|
| 331 | struct block_list |
|---|
| 332 | { |
|---|
| 333 |  void *address; |
|---|
| 334 |  struct block_list *next; |
|---|
| 335 | }; |
|---|
| 336 | # define ADD_BLOCK(list, addr)              \ |
|---|
| 337 |  do {                    \ |
|---|
| 338 |   struct block_list *newp = (struct block_list *) malloc (sizeof (*newp)); \ |
|---|
| 339 | Â Â |
|---|
| 340 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â \ |
|---|
| 341 |   if (newp != NULL) {                \ |
|---|
| 342 | Â Â Â newp->address = (addr);Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â \ |
|---|
| 343 | Â Â Â newp->next = (list);Â Â Â Â Â Â Â Â Â Â Â Â Â Â \ |
|---|
| 344 | Â Â Â (list) = newp;Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â \ |
|---|
| 345 | Â Â }Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â \ |
|---|
| 346 |  } while (0) |
|---|
| 347 | # define FREE_BLOCKS(list)              \ |
|---|
| 348 |  do {                    \ |
|---|
| 349 |   while (list != NULL) {              \ |
|---|
| 350 |    struct block_list *old = list;             \ |
|---|
| 351 | Â Â Â list = list->next;Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â \ |
|---|
| 352 | Â Â Â free (old->address);Â Â Â Â Â Â Â Â Â Â Â Â Â Â \ |
|---|
| 353 | Â Â Â free (old);Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â \ |
|---|
| 354 | Â Â }Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â \ |
|---|
| 355 |  } while (0) |
|---|
| 356 | # undef alloca |
|---|
| 357 | # define alloca(size) (malloc (size)) |
|---|
| 358 | # define freea(p) free (p) |
|---|
| 359 | #endif |
|---|
| 360 | |
|---|
| 361 | |
|---|
| 362 | #ifdef _LIBC |
|---|
| 363 | |
|---|
| 364 | typedef struct transmem_list |
|---|
| 365 | { |
|---|
| 366 |  struct transmem_list *next; |
|---|
| 367 |  char data[ZERO]; |
|---|
| 368 | } transmem_block_t; |
|---|
| 369 | static struct transmem_list *transmem_list; |
|---|
| 370 | #else |
|---|
| 371 | typedef unsigned char transmem_block_t; |
|---|
| 372 | #endif |
|---|
| 373 | |
|---|
| 374 | |
|---|
| 375 | |
|---|
| 376 | |
|---|
| 377 | |
|---|
| 378 | |
|---|
| 379 | #ifdef _LIBC |
|---|
| 380 | # define DCIGETTEXT __dcigettext |
|---|
| 381 | #else |
|---|
| 382 | # define DCIGETTEXT libintl_dcigettext |
|---|
| 383 | #endif |
|---|
| 384 | |
|---|
| 385 | |
|---|
| 386 | #ifdef _LIBC |
|---|
| 387 | __libc_rwlock_define_initialized (, _nl_state_lock attribute_hidden) |
|---|
| 388 | #endif |
|---|
| 389 | |
|---|
| 390 | |
|---|
| 391 | |
|---|
| 392 | #ifdef _LIBC |
|---|
| 393 | # define ENABLE_SECURE __libc_enable_secure |
|---|
| 394 | # define DETERMINE_SECURE |
|---|
| 395 | #else |
|---|
| 396 | # ifndef HAVE_GETUID |
|---|
| 397 | # define getuid() 0 |
|---|
| 398 | # endif |
|---|
| 399 | # ifndef HAVE_GETGID |
|---|
| 400 | # define getgid() 0 |
|---|
| 401 | # endif |
|---|
| 402 | # ifndef HAVE_GETEUID |
|---|
| 403 | # define geteuid() getuid() |
|---|
| 404 | # endif |
|---|
| 405 | # ifndef HAVE_GETEGID |
|---|
| 406 | # define getegid() getgid() |
|---|
| 407 | # endif |
|---|
| 408 | static int enable_secure; |
|---|
| 409 | # define ENABLE_SECURE (enable_secure == 1) |
|---|
| 410 | # define DETERMINE_SECURE \ |
|---|
| 411 |  if (enable_secure == 0)               \ |
|---|
| 412 | Â Â {Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â \ |
|---|
| 413 |    if (getuid () != geteuid () || getgid () != getegid ())       \ |
|---|
| 414 | Â Â enable_secure = 1;Â Â Â Â Â Â Â Â Â Â Â Â Â Â \ |
|---|
| 415 |    else                  \ |
|---|
| 416 | Â Â enable_secure = -1;Â Â Â Â Â Â Â Â Â Â Â Â Â Â \ |
|---|
| 417 | Â Â } |
|---|
| 418 | #endif |
|---|
| 419 | |
|---|
| 420 | |
|---|
| 421 | #include "eval-plural.h" |
|---|
| 422 | |
|---|
| 423 | |
|---|
| 424 | |
|---|
| 425 | |
|---|
| 426 | char * |
|---|
| 427 | DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2, |
|---|
| 428 |     int plural, unsigned long int n, int category) |
|---|
| 429 | { |
|---|
| 430 | #ifndef HAVE_ALLOCA |
|---|
| 431 |  struct block_list *block_list = NULL; |
|---|
| 432 | #endif |
|---|
| 433 |  struct loaded_l10nfile *domain; |
|---|
| 434 |  struct binding *binding; |
|---|
| 435 |  const char *categoryname; |
|---|
| 436 |  const char *categoryvalue; |
|---|
| 437 |  char *dirname, *xdomainname; |
|---|
| 438 |  char *single_locale; |
|---|
| 439 |  char *retval; |
|---|
| 440 | Â size_t retlen; |
|---|
| 441 |  int saved_errno; |
|---|
| 442 | #if defined HAVE_TSEARCH || defined _LIBC |
|---|
| 443 |  struct known_translation_t *search; |
|---|
| 444 |  struct known_translation_t **foundp = NULL; |
|---|
| 445 | Â size_t msgid_len; |
|---|
| 446 | #endif |
|---|
| 447 | Â size_t domainname_len; |
|---|
| 448 | |
|---|
| 449 | Â |
|---|
| 450 |  if (msgid1 == NULL) |
|---|
| 451 |   return NULL; |
|---|
| 452 | |
|---|
| 453 | #ifdef _LIBC |
|---|
| 454 |  if (category < 0 || category >= __LC_LAST || category == LC_ALL) |
|---|
| 455 | Â Â |
|---|
| 456 |   return (plural == 0 |
|---|
| 457 |     ? (char *) msgid1 |
|---|
| 458 | Â Â Â Â |
|---|
| 459 |     : n == 1 ? (char *) msgid1 : (char *) msgid2); |
|---|
| 460 | #endif |
|---|
| 461 | |
|---|
| 462 | Â __libc_rwlock_rdlock (_nl_state_lock); |
|---|
| 463 | |
|---|
| 464 | Â |
|---|
| 465 | |
|---|
| 466 | |
|---|
| 467 |  if (domainname == NULL) |
|---|
| 468 | Â Â domainname = _nl_current_default_domain; |
|---|
| 469 | |
|---|
| 470 | Â |
|---|
| 471 | #ifdef LC_MESSAGES_COMPAT |
|---|
| 472 |  if (category == LC_MESSAGES_COMPAT) |
|---|
| 473 | Â Â category = LC_MESSAGES; |
|---|
| 474 | #endif |
|---|
| 475 | |
|---|
| 476 | #if defined HAVE_TSEARCH || defined _LIBC |
|---|
| 477 | Â msgid_len = strlen (msgid1) + 1; |
|---|
| 478 | |
|---|
| 479 | Â |
|---|
| 480 | |
|---|
| 481 |  search = (struct known_translation_t *) |
|---|
| 482 |     alloca (offsetof (struct known_translation_t, msgid) + msgid_len); |
|---|
| 483 | Â memcpy (search->msgid, msgid1, msgid_len); |
|---|
| 484 |  search->domainname = (char *) domainname; |
|---|
| 485 | Â search->category = category; |
|---|
| 486 | |
|---|
| 487 |  foundp = (struct known_translation_t **) tfind (search, &root, transcmp); |
|---|
| 488 | Â freea (search); |
|---|
| 489 |  if (foundp != NULL && (*foundp)->counter == _nl_msg_cat_cntr) |
|---|
| 490 | Â Â { |
|---|
| 491 | Â Â Â |
|---|
| 492 |    if (plural) |
|---|
| 493 | Â Â retval = plural_lookup ((*foundp)->domain, n, (*foundp)->translation, |
|---|
| 494 | Â Â Â Â Â Â Â Â (*foundp)->translation_length); |
|---|
| 495 | Â Â Â else |
|---|
| 496 |   retval = (char *) (*foundp)->translation; |
|---|
| 497 | |
|---|
| 498 | Â Â Â __libc_rwlock_unlock (_nl_state_lock); |
|---|
| 499 |    return retval; |
|---|
| 500 | Â Â } |
|---|
| 501 | #endif |
|---|
| 502 | |
|---|
| 503 | Â |
|---|
| 504 | Â saved_errno = errno; |
|---|
| 505 | |
|---|
| 506 | Â |
|---|
| 507 | Â DETERMINE_SECURE; |
|---|
| 508 | |
|---|
| 509 | Â |
|---|
| 510 |  for (binding = _nl_domain_bindings; binding != NULL; binding = binding->next) |
|---|
| 511 | Â Â { |
|---|
| 512 |    int compare = strcmp (domainname, binding->domainname); |
|---|
| 513 |    if (compare == 0) |
|---|
| 514 | Â Â |
|---|
| 515 | Â Â break; |
|---|
| 516 |    if (compare < 0) |
|---|
| 517 | Â Â { |
|---|
| 518 | Â Â Â |
|---|
| 519 | Â Â Â binding = NULL; |
|---|
| 520 | Â Â Â break; |
|---|
| 521 | Â Â } |
|---|
| 522 | Â Â } |
|---|
| 523 | |
|---|
| 524 |  if (binding == NULL) |
|---|
| 525 |   dirname = (char *) INTUSE(_nl_default_dirname); |
|---|
| 526 |  else if (IS_ABSOLUTE_PATH (binding->dirname)) |
|---|
| 527 | Â Â dirname = binding->dirname; |
|---|
| 528 | Â else |
|---|
| 529 | Â Â { |
|---|
| 530 | Â Â Â |
|---|
| 531 | Â Â Â size_t dirname_len = strlen (binding->dirname) + 1; |
|---|
| 532 | Â Â Â size_t path_max; |
|---|
| 533 |    char *ret; |
|---|
| 534 | |
|---|
| 535 |    path_max = (unsigned int) PATH_MAX; |
|---|
| 536 | Â Â Â path_max += 2;Â Â Â Â |
|---|
| 537 | |
|---|
| 538 |    for (;;) |
|---|
| 539 | Â Â { |
|---|
| 540 |    dirname = (char *) alloca (path_max + dirname_len); |
|---|
| 541 | Â Â Â ADD_BLOCK (block_list, dirname); |
|---|
| 542 | |
|---|
| 543 | Â Â Â __set_errno (0); |
|---|
| 544 | Â Â Â ret = getcwd (dirname, path_max); |
|---|
| 545 |    if (ret != NULL || errno != ERANGE) |
|---|
| 546 | Â Â Â Â break; |
|---|
| 547 | |
|---|
| 548 | Â Â Â path_max += path_max / 2; |
|---|
| 549 | Â Â Â path_max += PATH_INCR; |
|---|
| 550 | Â Â } |
|---|
| 551 | |
|---|
| 552 |    if (ret == NULL) |
|---|
| 553 | Â Â |
|---|
| 554 | |
|---|
| 555 |   goto return_untranslated; |
|---|
| 556 | |
|---|
| 557 | Â Â Â stpcpy (stpcpy (strchr (dirname, '\0'), "/"), binding->dirname); |
|---|
| 558 | Â Â } |
|---|
| 559 | |
|---|
| 560 | Â |
|---|
| 561 | Â categoryname = category_to_name (category); |
|---|
| 562 | Â categoryvalue = guess_category_value (category, categoryname); |
|---|
| 563 | |
|---|
| 564 | Â domainname_len = strlen (domainname); |
|---|
| 565 |  xdomainname = (char *) alloca (strlen (categoryname) |
|---|
| 566 | Â Â Â Â Â Â Â Â Â + domainname_len + 5); |
|---|
| 567 | Â ADD_BLOCK (block_list, xdomainname); |
|---|
| 568 | |
|---|
| 569 | Â stpcpy (mempcpy (stpcpy (stpcpy (xdomainname, categoryname), "/"), |
|---|
| 570 | Â Â Â Â Â domainname, domainname_len), |
|---|
| 571 | Â Â Â ".mo"); |
|---|
| 572 | |
|---|
| 573 | Â |
|---|
| 574 |  single_locale = (char *) alloca (strlen (categoryvalue) + 1); |
|---|
| 575 | Â ADD_BLOCK (block_list, single_locale); |
|---|
| 576 | |
|---|
| 577 | |
|---|
| 578 | Â |
|---|
| 579 | |
|---|
| 580 |  while (1) |
|---|
| 581 | Â Â { |
|---|
| 582 | Â Â Â |
|---|
| 583 |    while (categoryvalue[0] != '\0' && categoryvalue[0] == ':') |
|---|
| 584 | Â Â ++categoryvalue; |
|---|
| 585 |    if (categoryvalue[0] == '\0') |
|---|
| 586 | Â Â { |
|---|
| 587 | Â Â Â |
|---|
| 588 | |
|---|
| 589 | |
|---|
| 590 | |
|---|
| 591 | Â Â Â single_locale[0] = 'C'; |
|---|
| 592 | Â Â Â single_locale[1] = '\0'; |
|---|
| 593 | Â Â } |
|---|
| 594 | Â Â Â else |
|---|
| 595 | Â Â { |
|---|
| 596 |    char *cp = single_locale; |
|---|
| 597 |    while (categoryvalue[0] != '\0' && categoryvalue[0] != ':') |
|---|
| 598 | Â Â Â Â *cp++ = *categoryvalue++; |
|---|
| 599 | Â Â Â *cp = '\0'; |
|---|
| 600 | |
|---|
| 601 | Â Â Â |
|---|
| 602 | |
|---|
| 603 |    if (ENABLE_SECURE && IS_PATH_WITH_DIR (single_locale)) |
|---|
| 604 | Â Â Â Â |
|---|
| 605 | Â Â Â Â continue; |
|---|
| 606 | Â Â } |
|---|
| 607 | |
|---|
| 608 | Â Â Â |
|---|
| 609 | |
|---|
| 610 |    if (strcmp (single_locale, "C") == 0 |
|---|
| 611 | Â Â Â || strcmp (single_locale, "POSIX") == 0) |
|---|
| 612 | Â Â break; |
|---|
| 613 | |
|---|
| 614 | Â Â Â |
|---|
| 615 | |
|---|
| 616 | Â Â Â domain = _nl_find_domain (dirname, single_locale, xdomainname, binding); |
|---|
| 617 | |
|---|
| 618 |    if (domain != NULL) |
|---|
| 619 | Â Â { |
|---|
| 620 | Â Â Â retval = _nl_find_msg (domain, binding, msgid1, &retlen); |
|---|
| 621 | |
|---|
| 622 |    if (retval == NULL) |
|---|
| 623 | Â Â Â Â { |
|---|
| 624 |      int cnt; |
|---|
| 625 | |
|---|
| 626 |      for (cnt = 0; domain->successor[cnt] != NULL; ++cnt) |
|---|
| 627 | Â Â Â Â { |
|---|
| 628 | Â Â Â Â Â retval = _nl_find_msg (domain->successor[cnt], binding, |
|---|
| 629 | Â Â Â Â Â Â Â Â Â Â Â msgid1, &retlen); |
|---|
| 630 | |
|---|
| 631 |      if (retval != NULL) |
|---|
| 632 | Â Â Â Â Â Â { |
|---|
| 633 | Â Â Â Â Â Â Â domain = domain->successor[cnt]; |
|---|
| 634 | Â Â Â Â Â Â Â break; |
|---|
| 635 | Â Â Â Â Â Â } |
|---|
| 636 | Â Â Â Â } |
|---|
| 637 | Â Â Â Â } |
|---|
| 638 | |
|---|
| 639 |    if (retval != NULL) |
|---|
| 640 | Â Â Â Â { |
|---|
| 641 | Â Â Â Â Â |
|---|
| 642 | |
|---|
| 643 | Â Â Â Â Â FREE_BLOCKS (block_list); |
|---|
| 644 | #if defined HAVE_TSEARCH || defined _LIBC |
|---|
| 645 |      if (foundp == NULL) |
|---|
| 646 | Â Â Â Â { |
|---|
| 647 | Â Â Â Â Â |
|---|
| 648 |      struct known_translation_t *newp; |
|---|
| 649 | |
|---|
| 650 |      newp = (struct known_translation_t *) |
|---|
| 651 |       malloc (offsetof (struct known_translation_t, msgid) |
|---|
| 652 | Â Â Â Â Â Â Â Â + msgid_len + domainname_len + 1); |
|---|
| 653 |      if (newp != NULL) |
|---|
| 654 | Â Â Â Â Â Â { |
|---|
| 655 | Â Â Â Â Â Â Â newp->domainname = |
|---|
| 656 | Â Â Â Â Â Â mempcpy (newp->msgid, msgid1, msgid_len); |
|---|
| 657 | Â Â Â Â Â Â Â memcpy (newp->domainname, domainname, domainname_len + 1); |
|---|
| 658 | Â Â Â Â Â Â Â newp->category = category; |
|---|
| 659 | Â Â Â Â Â Â Â newp->counter = _nl_msg_cat_cntr; |
|---|
| 660 | Â Â Â Â Â Â Â newp->domain = domain; |
|---|
| 661 | Â Â Â Â Â Â Â newp->translation = retval; |
|---|
| 662 | Â Â Â Â Â Â Â newp->translation_length = retlen; |
|---|
| 663 | |
|---|
| 664 | Â Â Â Â Â Â Â |
|---|
| 665 |        foundp = (struct known_translation_t **) |
|---|
| 666 | Â Â Â Â Â Â tsearch (newp, &root, transcmp); |
|---|
| 667 |        if (foundp == NULL |
|---|
| 668 | Â Â Â Â Â Â Â || __builtin_expect (*foundp != newp, 0)) |
|---|
| 669 | Â Â Â Â Â Â |
|---|
| 670 | Â Â Â Â Â Â free (newp); |
|---|
| 671 | Â Â Â Â Â Â } |
|---|
| 672 | Â Â Â Â } |
|---|
| 673 | Â Â Â Â Â else |
|---|
| 674 | Â Â Â Â { |
|---|
| 675 | Â Â Â Â Â |
|---|
| 676 | Â Â Â Â Â (*foundp)->counter = _nl_msg_cat_cntr; |
|---|
| 677 | Â Â Â Â Â (*foundp)->domain = domain; |
|---|
| 678 | Â Â Â Â Â (*foundp)->translation = retval; |
|---|
| 679 | Â Â Â Â Â (*foundp)->translation_length = retlen; |
|---|
| 680 | Â Â Â Â } |
|---|
| 681 | #endif |
|---|
| 682 | Â Â Â Â Â __set_errno (saved_errno); |
|---|
| 683 | |
|---|
| 684 | Â Â Â Â Â |
|---|
| 685 |      if (plural) |
|---|
| 686 | Â Â Â Â retval = plural_lookup (domain, n, retval, retlen); |
|---|
| 687 | |
|---|
| 688 | Â Â Â Â Â __libc_rwlock_unlock (_nl_state_lock); |
|---|
| 689 |      return retval; |
|---|
| 690 | Â Â Â Â } |
|---|
| 691 | Â Â } |
|---|
| 692 | Â Â } |
|---|
| 693 | |
|---|
| 694 | Â return_untranslated: |
|---|
| 695 | Â |
|---|
| 696 | Â FREE_BLOCKS (block_list); |
|---|
| 697 | Â __libc_rwlock_unlock (_nl_state_lock); |
|---|
| 698 | #ifndef _LIBC |
|---|
| 699 |  if (!ENABLE_SECURE) |
|---|
| 700 | Â Â { |
|---|
| 701 |    extern void _nl_log_untranslated (const char *logfilename, |
|---|
| 702 |           const char *domainname, |
|---|
| 703 |           const char *msgid1, const char *msgid2, |
|---|
| 704 |           int plural); |
|---|
| 705 |    const char *logfilename = getenv ("GETTEXT_LOG_UNTRANSLATED"); |
|---|
| 706 | |
|---|
| 707 |    if (logfilename != NULL && logfilename[0] != '\0') |
|---|
| 708 | Â Â _nl_log_untranslated (logfilename, domainname, msgid1, msgid2, plural); |
|---|
| 709 | Â Â } |
|---|
| 710 | #endif |
|---|
| 711 | Â __set_errno (saved_errno); |
|---|
| 712 |  return (plural == 0 |
|---|
| 713 |    ? (char *) msgid1 |
|---|
| 714 | Â Â Â |
|---|
| 715 |    : n == 1 ? (char *) msgid1 : (char *) msgid2); |
|---|
| 716 | } |
|---|
| 717 | |
|---|
| 718 | |
|---|
| 719 | char * |
|---|
| 720 | internal_function |
|---|
| 721 | _nl_find_msg (struct loaded_l10nfile *domain_file, |
|---|
| 722 |      struct binding *domainbinding, const char *msgid, |
|---|
| 723 | Â Â Â Â Â size_t *lengthp) |
|---|
| 724 | { |
|---|
| 725 |  struct loaded_domain *domain; |
|---|
| 726 | Â nls_uint32 nstrings; |
|---|
| 727 | Â size_t act; |
|---|
| 728 |  char *result; |
|---|
| 729 | Â size_t resultlen; |
|---|
| 730 | |
|---|
| 731 |  if (domain_file->decided == 0) |
|---|
| 732 | Â Â _nl_load_domain (domain_file, domainbinding); |
|---|
| 733 | |
|---|
| 734 |  if (domain_file->data == NULL) |
|---|
| 735 |   return NULL; |
|---|
| 736 | |
|---|
| 737 |  domain = (struct loaded_domain *) domain_file->data; |
|---|
| 738 | |
|---|
| 739 | Â nstrings = domain->nstrings; |
|---|
| 740 | |
|---|
| 741 | Â |
|---|
| 742 |  if (domain->hash_tab != NULL) |
|---|
| 743 | Â Â { |
|---|
| 744 | Â Â Â |
|---|
| 745 | Â Â Â nls_uint32 len = strlen (msgid); |
|---|
| 746 | Â Â Â nls_uint32 hash_val = hash_string (msgid); |
|---|
| 747 | Â Â Â nls_uint32 idx = hash_val % domain->hash_size; |
|---|
| 748 | Â Â Â nls_uint32 incr = 1 + (hash_val % (domain->hash_size - 2)); |
|---|
| 749 | |
|---|
| 750 |    while (1) |
|---|
| 751 | Â Â { |
|---|
| 752 | Â Â Â nls_uint32 nstr = |
|---|
| 753 | Â Â Â Â W (domain->must_swap_hash_tab, domain->hash_tab[idx]); |
|---|
| 754 | |
|---|
| 755 |    if (nstr == 0) |
|---|
| 756 | Â Â Â Â |
|---|
| 757 |     return NULL; |
|---|
| 758 | |
|---|
| 759 | Â Â Â nstr--; |
|---|
| 760 | |
|---|
| 761 | Â Â Â |
|---|
| 762 | |
|---|
| 763 | |
|---|
| 764 |    if (nstr < nstrings |
|---|
| 765 | Â Â Â Â Â ? W (domain->must_swap, domain->orig_tab[nstr].length) >= len |
|---|
| 766 | Â Â Â Â && (strcmp (msgid, |
|---|
| 767 | Â Â Â Â Â Â Â Â domain->data + W (domain->must_swap, |
|---|
| 768 | Â Â Â Â Â Â Â Â Â Â Â Â Â domain->orig_tab[nstr].offset)) |
|---|
| 769 | Â Â Â Â Â Â == 0) |
|---|
| 770 | Â Â Â Â Â : domain->orig_sysdep_tab[nstr - nstrings].length > len |
|---|
| 771 | Â Â Â Â && (strcmp (msgid, |
|---|
| 772 | Â Â Â Â Â Â Â Â domain->orig_sysdep_tab[nstr - nstrings].pointer) |
|---|
| 773 | Â Â Â Â Â Â == 0)) |
|---|
| 774 | Â Â Â Â { |
|---|
| 775 | Â Â Â Â Â act = nstr; |
|---|
| 776 |      goto found; |
|---|
| 777 | Â Â Â Â } |
|---|
| 778 | |
|---|
| 779 |    if (idx >= domain->hash_size - incr) |
|---|
| 780 | Â Â Â Â idx -= domain->hash_size - incr; |
|---|
| 781 | Â Â Â else |
|---|
| 782 | Â Â Â Â idx += incr; |
|---|
| 783 | Â Â } |
|---|
| 784 | Â Â Â |
|---|
| 785 | Â Â } |
|---|
| 786 | Â else |
|---|
| 787 | Â Â { |
|---|
| 788 | Â Â Â |
|---|
| 789 | |
|---|
| 790 | Â Â Â size_t top, bottom; |
|---|
| 791 | |
|---|
| 792 | Â Â Â bottom = 0; |
|---|
| 793 | Â Â Â top = nstrings; |
|---|
| 794 |    while (bottom < top) |
|---|
| 795 | Â Â { |
|---|
| 796 |    int cmp_val; |
|---|
| 797 | |
|---|
| 798 | Â Â Â act = (bottom + top) / 2; |
|---|
| 799 | Â Â Â cmp_val = strcmp (msgid, (domain->data |
|---|
| 800 | Â Â Â Â Â Â Â Â Â Â + W (domain->must_swap, |
|---|
| 801 | Â Â Â Â Â Â Â Â Â Â Â domain->orig_tab[act].offset))); |
|---|
| 802 |    if (cmp_val < 0) |
|---|
| 803 | Â Â Â Â top = act; |
|---|
| 804 |    else if (cmp_val > 0) |
|---|
| 805 | Â Â Â Â bottom = act + 1; |
|---|
| 806 | Â Â Â else |
|---|
| 807 |     goto found; |
|---|
| 808 | Â Â } |
|---|
| 809 | Â Â Â |
|---|
| 810 |    return NULL; |
|---|
| 811 | Â Â } |
|---|
| 812 | |
|---|
| 813 | Â found: |
|---|
| 814 | Â |
|---|
| 815 | |
|---|
| 816 |  if (act < nstrings) |
|---|
| 817 | Â Â { |
|---|
| 818 |    result = (char *) |
|---|
| 819 | Â Â (domain->data + W (domain->must_swap, domain->trans_tab[act].offset)); |
|---|
| 820 | Â Â Â resultlen = W (domain->must_swap, domain->trans_tab[act].length) + 1; |
|---|
| 821 | Â Â } |
|---|
| 822 | Â else |
|---|
| 823 | Â Â { |
|---|
| 824 |    result = (char *) domain->trans_sysdep_tab[act - nstrings].pointer; |
|---|
| 825 | Â Â Â resultlen = domain->trans_sysdep_tab[act - nstrings].length; |
|---|
| 826 | Â Â } |
|---|
| 827 | |
|---|
| 828 | #if defined _LIBC || HAVE_ICONV |
|---|
| 829 |  if (domain->codeset_cntr |
|---|
| 830 | Â Â Â != (domainbinding != NULL ? domainbinding->codeset_cntr : 0)) |
|---|
| 831 | Â Â { |
|---|
| 832 | Â Â Â |
|---|
| 833 | |
|---|
| 834 | |
|---|
| 835 | Â Â Â _nl_free_domain_conv (domain); |
|---|
| 836 | Â Â Â _nl_init_domain_conv (domain_file, domain, domainbinding); |
|---|
| 837 | Â Â } |
|---|
| 838 | |
|---|
| 839 |  if ( |
|---|
| 840 | # ifdef _LIBC |
|---|
| 841 | Â Â Â domain->conv != (__gconv_t) -1 |
|---|
| 842 | # else |
|---|
| 843 | # if HAVE_ICONV |
|---|
| 844 | Â Â Â domain->conv != (iconv_t) -1 |
|---|
| 845 | #Â endif |
|---|
| 846 | # endif |
|---|
| 847 | Â Â Â ) |
|---|
| 848 | Â Â { |
|---|
| 849 | Â Â Â |
|---|
| 850 | |
|---|
| 851 | |
|---|
| 852 | |
|---|
| 853 | |
|---|
| 854 | |
|---|
| 855 | |
|---|
| 856 | |
|---|
| 857 | |
|---|
| 858 |    if (domain->conv_tab == NULL |
|---|
| 859 | Â Â Â && ((domain->conv_tab = |
|---|
| 860 |      (char **) calloc (nstrings + domain->n_sysdep_strings, |
|---|
| 861 |           sizeof (char *))) |
|---|
| 862 | Â Â Â Â Â == NULL)) |
|---|
| 863 | Â Â |
|---|
| 864 |   domain->conv_tab = (char **) -1; |
|---|
| 865 | |
|---|
| 866 |    if (__builtin_expect (domain->conv_tab == (char **) -1, 0)) |
|---|
| 867 | Â Â |
|---|
| 868 |   goto converted; |
|---|
| 869 | |
|---|
| 870 |    if (domain->conv_tab[act] == NULL) |
|---|
| 871 | Â Â { |
|---|
| 872 | Â Â Â |
|---|
| 873 | |
|---|
| 874 | Â Â Â |
|---|
| 875 | |
|---|
| 876 | |
|---|
| 877 | Â Â Â __libc_lock_define_initialized (static, lock) |
|---|
| 878 | # define INITIAL_BLOCK_SIZE 4080 |
|---|
| 879 |    static unsigned char *freemem; |
|---|
| 880 |    static size_t freemem_size; |
|---|
| 881 | |
|---|
| 882 |    const unsigned char *inbuf; |
|---|
| 883 |    unsigned char *outbuf; |
|---|
| 884 |    int malloc_count; |
|---|
| 885 | # ifndef _LIBC |
|---|
| 886 | Â Â Â transmem_block_t *transmem_list = NULL; |
|---|
| 887 | # endif |
|---|
| 888 | |
|---|
| 889 | Â Â Â __libc_lock_lock (lock); |
|---|
| 890 | |
|---|
| 891 |    inbuf = (const unsigned char *) result; |
|---|
| 892 |    outbuf = freemem + sizeof (size_t); |
|---|
| 893 | |
|---|
| 894 | Â Â Â malloc_count = 0; |
|---|
| 895 |    while (1) |
|---|
| 896 | Â Â Â Â { |
|---|
| 897 | Â Â Â Â Â transmem_block_t *newmem; |
|---|
| 898 | # ifdef _LIBC |
|---|
| 899 | Â Â Â Â Â size_t non_reversible; |
|---|
| 900 |      int res; |
|---|
| 901 | |
|---|
| 902 |      if (freemem_size < sizeof (size_t)) |
|---|
| 903 |     goto resize_freemem; |
|---|
| 904 | |
|---|
| 905 | Â Â Â Â Â res = __gconv (domain->conv, |
|---|
| 906 | Â Â Â Â Â Â Â Â Â &inbuf, inbuf + resultlen, |
|---|
| 907 | Â Â Â Â Â Â Â Â Â &outbuf, |
|---|
| 908 |          outbuf + freemem_size - sizeof (size_t), |
|---|
| 909 | Â Â Â Â Â Â Â Â Â &non_reversible); |
|---|
| 910 | |
|---|
| 911 |      if (res == __GCONV_OK || res == __GCONV_EMPTY_INPUT) |
|---|
| 912 | Â Â Â Â break; |
|---|
| 913 | |
|---|
| 914 |      if (res != __GCONV_FULL_OUTPUT) |
|---|
| 915 | Â Â Â Â { |
|---|
| 916 | Â Â Â Â Â __libc_lock_unlock (lock); |
|---|
| 917 |      goto converted; |
|---|
| 918 | Â Â Â Â } |
|---|
| 919 | |
|---|
| 920 | Â Â Â Â Â inbuf = result; |
|---|
| 921 | # else |
|---|
| 922 | # if HAVE_ICONV |
|---|
| 923 |      const char *inptr = (const char *) inbuf; |
|---|
| 924 | Â Â Â Â Â size_t inleft = resultlen; |
|---|
| 925 |      char *outptr = (char *) outbuf; |
|---|
| 926 | Â Â Â Â Â size_t outleft; |
|---|
| 927 | |
|---|
| 928 |      if (freemem_size < sizeof (size_t)) |
|---|
| 929 |     goto resize_freemem; |
|---|
| 930 | |
|---|
| 931 |      outleft = freemem_size - sizeof (size_t); |
|---|
| 932 |      if (iconv (domain->conv, |
|---|
| 933 |        (ICONV_CONST char **) &inptr, &inleft, |
|---|
| 934 | Â Â Â Â Â Â Â &outptr, &outleft) |
|---|
| 935 | Â Â Â Â Â != (size_t) (-1)) |
|---|
| 936 | Â Â Â Â { |
|---|
| 937 |      outbuf = (unsigned char *) outptr; |
|---|
| 938 | Â Â Â Â Â break; |
|---|
| 939 | Â Â Â Â } |
|---|
| 940 |      if (errno != E2BIG) |
|---|
| 941 | Â Â Â Â { |
|---|
| 942 | Â Â Â Â Â __libc_lock_unlock (lock); |
|---|
| 943 |      goto converted; |
|---|
| 944 | Â Â Â Â } |
|---|
| 945 | #Â endif |
|---|
| 946 | # endif |
|---|
| 947 | |
|---|
| 948 | Â Â Â Â resize_freemem: |
|---|
| 949 | Â Â Â Â Â |
|---|
| 950 |      if (malloc_count > 0) |
|---|
| 951 | Â Â Â Â { |
|---|
| 952 | Â Â Â Â Â ++malloc_count; |
|---|
| 953 | Â Â Â Â Â freemem_size = malloc_count * INITIAL_BLOCK_SIZE; |
|---|
| 954 | Â Â Â Â Â newmem = (transmem_block_t *) realloc (transmem_list, |
|---|
| 955 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â freemem_size); |
|---|
| 956 | # ifdef _LIBC |
|---|
| 957 |      if (newmem != NULL) |
|---|
| 958 | Â Â Â Â Â Â |
|---|