예제 #1
0
U_CAPI void * U_EXPORT2
utm_allocN(UToolMemory *mem, int32_t n) {
    char *p=(char *)mem->array+mem->index*mem->size;
    int32_t newIndex=mem->index+n;
    if(utm_hasCapacity(mem, newIndex)) {
        mem->index=newIndex;
        uprv_memset(p, 0, n*mem->size);
    }
    return p;
}
예제 #2
0
U_CAPI void * U_EXPORT2
utm_alloc(UToolMemory *mem) {
    char *p=NULL;
    int32_t oldIndex=mem->idx;
    int32_t newIndex=oldIndex+1;
    if(utm_hasCapacity(mem, newIndex)) {
        p=(char *)mem->array+oldIndex*mem->size;
        mem->idx=newIndex;
        uprv_memset(p, 0, mem->size);
    }
    return p;
}