mem2swap.c
changeset 82 7ff8fc49cce4
parent 77 49e0babccb23
child 91 1181deef3bd6
equal deleted inserted replaced
81:6cfca66d2f01 82:7ff8fc49cce4
    49 
    49 
    50     if ((p = malloc (N * size)) == NULL)
    50     if ((p = malloc (N * size)) == NULL)
    51         return EXIT_FAILURE;
    51         return EXIT_FAILURE;
    52 
    52 
    53     for (;;) {
    53     for (;;) {
    54         for (i = 0; i < N; i++) {
    54         for (i = 0; i < N; i++)
    55             p[n * N + i] = size * (n * N + i);
    55             p[n * N + i] = size * (n * N + i);
    56         }
       
    57         if ((p_new = realloc (p, (++n + 1) * N * size)))
    56         if ((p_new = realloc (p, (++n + 1) * N * size)))
    58             p = p_new;
    57             p = p_new;
    59         else
    58         else
    60             break;
    59             break;
    61     }
    60     }