Legofit
infers population history from nucleotide site patterns.
Loading...
Searching...
No Matches
ptrvec.c File Reference
#include "ptrvec.h"
#include "misc.h"
#include <stdio.h>
#include <stdlib.h>

Functions

PtrVecPtrVec_new (unsigned n)
 Allocate an array with room for n pointers.
void PtrVec_free (PtrVec *self)
int PtrVec_push (PtrVec *self, void *val)
void * PtrVec_pop (PtrVec *self)
int PtrVec_resize (PtrVec *self, unsigned size)
 Enlarge size of allocated buffer if necessary.

Function Documentation

◆ PtrVec_resize()

int PtrVec_resize ( PtrVec * self,
unsigned size )

Enlarge size of allocated buffer if necessary.

Does a fresh malloc if used==0. Otherwise, calls realloc. Returns 0 on success, ENOMEM if allocation fails.