Subversion Repositories HelenOS

Rev

Rev 4055 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4055 Rev 4537
Line 117... Line 117...
117
{
117
{
118
    int rc;
118
    int rc;
119
    void *res;
119
    void *res;
120
   
120
   
121
    /* Check for invalid values */
121
    /* Check for invalid values */
122
    if (incr < 0 && -incr > heapsize)
122
    if ((incr < 0) && (((size_t) -incr) > heapsize))
123
        return NULL;
123
        return NULL;
124
   
124
   
125
    /* Check for too large value */
125
    /* Check for too large value */
126
    if (incr > 0 && incr+heapsize < heapsize)
126
    if ((incr > 0) && (incr + heapsize < heapsize))
127
        return NULL;
127
        return NULL;
128
   
128
   
129
    /* Check for too small values */
129
    /* Check for too small values */
130
    if (incr < 0 && incr+heapsize > heapsize)
130
    if ((incr < 0) && (incr + heapsize > heapsize))
131
        return NULL;
131
        return NULL;
132
   
132
   
133
    /* Check for user limit */
133
    /* Check for user limit */
134
    if ((maxheapsize != (size_t) (-1)) && (heapsize + incr) > maxheapsize)
134
    if ((maxheapsize != (size_t) (-1)) && (heapsize + incr) > maxheapsize)
135
        return NULL;
135
        return NULL;
Line 173... Line 173...
173
        return NULL;   
173
        return NULL;   
174
 
174
 
175
    asz = 1 << (fnzb64(sz - 1) + 1);
175
    asz = 1 << (fnzb64(sz - 1) + 1);
176
 
176
 
177
    /* Set heapsize to some meaningful value */
177
    /* Set heapsize to some meaningful value */
178
    if (maxheapsize == -1)
178
    if (maxheapsize == (size_t) -1)
179
        set_maxheapsize(MAX_HEAP_SIZE);
179
        set_maxheapsize(MAX_HEAP_SIZE);
180
   
180
   
181
    /*
181
    /*
182
     * Make sure we allocate from naturally aligned address.
182
     * Make sure we allocate from naturally aligned address.
183
     */
183
     */