/****************************************** * alloc example with apr * Sylvain Marechal * 25/10/2005 *****************************************/ #include "apr_general.h" /********************************************* * apr_alloc ********************************************/ void test_palloc( apr_pool_t *pool ) { char * p; p = (char *)apr_palloc( pool, 100 ); strcpy( p, "coucou" ); printf( "allocated string: '%s'\n", p ); } /********************************************* * main ********************************************/ int main( int argc, char * argv[] ) { apr_pool_t *pool; if (apr_initialize() != APR_SUCCESS) { printf( "Could not initialize\n"); exit(-1); } if (apr_pool_create(&pool, NULL) != APR_SUCCESS) { printf( "Could not allocate pool\n"); exit( -1); } test_palloc( pool ); apr_pool_destroy( pool ); return 0; }