You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Doug MacEachern <do...@covalent.net> on 2001/03/16 01:37:06 UTC

apr_gethostname()

i just noticed that this function takes an apr_pool_t* argument, but none
of the implementations (unix, win32 , os2) use it for anything.  any
reason not to remove this unused arg?


Re: apr_gethostname()

Posted by rb...@covalent.net.
On Thu, 15 Mar 2001, Doug MacEachern wrote:

> On Thu, 15 Mar 2001 rbb@covalent.net wrote:
>
> > Yes.  All APR functions must have acess to a pool.  Imagine a platform
> > that requires we allocate memory for gethostname before we call the system
> > call.  If we don't pass the pool, we can't allocate the memory.  We are
> > trying to be future proof, which may be stupid, but that was part of the
> > original design.
>
> ok, this makes sense.  but i think you mean 'Most' not 'All' APR functions :)

The goal was all, but obviously we made some exceptions.  Any function
that works on the pool internals can't have access to a pool, because they
are working on the internals.  Any time function doesn't get a pool,
because the time type is a 64-bit integer, and any function moved down
from Apache doesn't follow this model.

Also, it is important to note that APR-utils doesn't have this design
goal, just APR itself.  APR-utils has a different goal than APR.  Because
APR-utils is supposed to use APR to do everything non-portable, we can say
with almost 100% accuracy which functions do and do not require a pool.

Ryan



Re: apr_gethostname()

Posted by Doug MacEachern <do...@covalent.net>.
On Thu, 15 Mar 2001 rbb@covalent.net wrote:
 
> Yes.  All APR functions must have acess to a pool.  Imagine a platform
> that requires we allocate memory for gethostname before we call the system
> call.  If we don't pass the pool, we can't allocate the memory.  We are
> trying to be future proof, which may be stupid, but that was part of the
> original design.

ok, this makes sense.  but i think you mean 'Most' not 'All' APR functions :)

an Apache::ParseSource scripted query reveals:

87 functions (out of 344) do not have access to a pool:

char * apr_strerror(apr_status_t statcode, char * buf, apr_size_t bufsize)

apr_size_t apr_pool_free_blocks_num_bytes()

void apr_pool_cleanup_for_exec()

apr_status_t apr_pool_cleanup_null(void * data)

apr_time_t apr_time_now()

apr_status_t apr_ansi_time_to_apr_time(apr_time_t * result, time_t input)

apr_status_t apr_explode_gmt(apr_exploded_time_t * result, apr_time_t input)

apr_status_t apr_explode_localtime(apr_exploded_time_t * result, apr_time_t input)

apr_status_t apr_implode_time(apr_time_t * result, apr_exploded_time_t * input)

void apr_sleep(apr_interval_time_t t)

apr_status_t apr_rfc822_date(char * date_str, apr_time_t t)

apr_status_t apr_ctime(char * date_str, apr_time_t t)

apr_status_t apr_strftime(char * s, apr_size_t * retsize, apr_size_t max, const char * format, apr_exploded_time_t * tm)

apr_status_t apr_file_perms_set(const char * fname, apr_fileperms_t perms)

apr_status_t apr_fnmatch(const char * pattern, const char * strings, int flags)

int apr_is_fnmatch(const char * pattern)

apr_status_t apr_generate_random_bytes(unsigned char * buf, int length)

apr_status_t apr_initialize()

void apr_terminate()

const char * apr_filename_of_pathname(const char * pathname)

int apr_vformatter(int (*flush_func)(apr_vformatter_buff_t *b) arg0, apr_vformatter_buff_t * c, const char * fmt, va_list ap)

apr_status_t apr_password_validate(const char * passwd, const char * hash)

apr_status_t apr_password_get(const char * prompt, char * pwbuf, size_t * bufsize)

apr_status_t apr_md5_encode(const char * password, const char * salt, char * result, size_t nbytes)

apr_status_t apr_proc_detach()

void apr_proc_other_child_unregister(void * data)

void apr_proc_other_child_check()

void apr_proc_probe_writable_fds()

apr_status_t apr_setup_signal_thread()

apr_status_t apr_os_exp_time_get(apr_os_exp_time_t ** ostime, apr_exploded_time_t * aprtime)

apr_status_t apr_os_imp_time_get(apr_os_imp_time_t ** ostime, apr_time_t * aprtime)

apr_status_t apr_shm_destroy(apr_shmem_t * m)

void * apr_shm_malloc(apr_shmem_t * c, apr_size_t reqsize)

void * apr_shm_calloc(apr_shmem_t * shared, apr_size_t size)

apr_status_t apr_shm_free(apr_shmem_t * shared, void * entity)

apr_status_t apr_shm_name_get(apr_shmem_t * c, apr_shm_name_t ** name)

apr_status_t apr_shm_name_set(apr_shmem_t * c, apr_shm_name_t * name)

apr_status_t apr_shm_open(apr_shmem_t * c)

apr_status_t apr_shm_avail(apr_shmem_t * c, apr_size_t * avail)

apr_sigfunc_t * apr_signal(int signo, apr_sigfunc_t * func)

const char * apr_signal_get_description(int signum)

int apr_strnatcmp(char const * a, char const * b)

int apr_strnatcasecmp(char const * a, char const * b)

char * apr_cpystrn(char * dst, const char * src, size_t dst_size)

char * apr_collapse_spaces(char * dest, const char * src)

int apr_snprintf(char * buf, size_t len, const char * format, ... arg3)

int apr_vsnprintf(char * buf, size_t len, const char * format, va_list ap)

void apr_uuid_get(apr_uuid_t * uuid)

void apr_uuid_format(char * buffer, const apr_uuid_t * uuid)

apr_status_t apr_uuid_parse(apr_uuid_t * uuid, const char * uuid_str)

int apr_base64_encode_len(int len)

int apr_base64_encode(char * coded_dst, const char * plain_src, int len_plain_src)

int apr_base64_encode_binary(char * coded_dst, const unsigned char * plain_src, int len_plain_src)

int apr_base64_decode_len(const char * coded_src)

int apr_base64_decode(char * plain_dst, const char * coded_src)

int apr_base64_decode_binary(unsigned char * plain_dst, const char * coded_src)

apr_status_t apr_bucket_setaside_notimpl(apr_bucket * data)

apr_status_t apr_bucket_split_notimpl(apr_bucket * data, apr_off_t point)

apr_status_t apr_bucket_copy_notimpl(apr_bucket * e, apr_bucket ** c)

void apr_bucket_destroy_notimpl(void * data)

apr_status_t apr_bucket_simple_split(apr_bucket * b, apr_off_t point)

apr_status_t apr_bucket_simple_copy(apr_bucket * a, apr_bucket ** b)

apr_bucket * apr_bucket_shared_make(apr_bucket * b, void * data, apr_off_t start, apr_off_t length)

int apr_bucket_shared_destroy(void * data)

apr_status_t apr_bucket_shared_split(apr_bucket * b, apr_off_t point)

apr_status_t apr_bucket_shared_copy(apr_bucket * a, apr_bucket ** b)

apr_bucket * apr_bucket_eos_create()

apr_bucket * apr_bucket_eos_make(apr_bucket * b)

apr_bucket * apr_bucket_flush_create()

apr_bucket * apr_bucket_flush_make(apr_bucket * b)

apr_bucket * apr_bucket_immortal_create(const char * buf, apr_size_t nbyte)

apr_bucket * apr_bucket_immortal_make(apr_bucket * b, const char * buf, apr_size_t nbyte)

apr_bucket * apr_bucket_transient_create(const char * buf, apr_size_t nbyte)

apr_bucket * apr_bucket_transient_make(apr_bucket * b, const char * buf, apr_size_t nbyte)

apr_bucket * apr_bucket_heap_create(const char * buf, apr_size_t nbyte, int copy, apr_size_t * w)

apr_bucket * apr_bucket_heap_make(apr_bucket * b, const char * buf, apr_size_t nbyte, int copy, apr_size_t * w)

void apr_hook_generic_add(const char * szName, void (*pfn)(void) arg1, const char * const * aszPre, const char * const * aszSucc, int nOrder)

apr_array_header_t * apr_hook_generic_get(const char * szName)

void apr_sort_hooks()

void apr_show_hook(const char * szName, const char * const * aszPre, const char * const * aszSucc)

void apr_hook_deregister_all()

void apr_register_optional_fn(const char * szName, void (*pfn)(void) arg1)

void apr_sha1_base64(const char * clear, int len, char * out)

void apr_sha1_init(apr_sha1_ctx_t * context)

void apr_sha1_update(apr_sha1_ctx_t * context, const char * input, unsigned int inputLen)

void apr_sha1_update_binary(apr_sha1_ctx_t * context, const unsigned char * input, unsigned int inputLen)

void apr_sha1_final(unsigned char digest, apr_sha1_ctx_t * context)



Re: apr_gethostname()

Posted by rb...@covalent.net.
On Thu, 15 Mar 2001, Doug MacEachern wrote:

> i just noticed that this function takes an apr_pool_t* argument, but none
> of the implementations (unix, win32 , os2) use it for anything.  any
> reason not to remove this unused arg?


Yes.  All APR functions must have acess to a pool.  Imagine a platform
that requires we allocate memory for gethostname before we call the system
call.  If we don't pass the pool, we can't allocate the memory.  We are
trying to be future proof, which may be stupid, but that was part of the
original design.

Ryan

_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------