Project

General

Profile

Bug #3361 ยป newlocale_loop.c

newlocale_loop.c test code - tonyc, 11/15/2023 05:09 PM

 
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int main() {
char psstr[40];
pid_t p = getpid();
snprintf(psstr, sizeof(psstr), "ps -l -p %ld", (long)p);

for (int i = 0; i < 1000000; ++i) {
if (i % 100000 == 0)
system(psstr);
locale_t l1 = newlocale(LC_ALL_MASK, "en_AU.UTF-8", (locale_t)0);
//locale_t old = uselocale(l1);
//uselocale(old);
freelocale(l1);
}
}
    (1-1/1)