Migrated options_t to INIT/METHOD macros

This commit is contained in:
Andreas Steffen 2010-12-04 08:21:21 +01:00
parent 503e1c558e
commit 4bb158c445

View File

@ -61,11 +61,8 @@ struct private_options_t {
char *buffers[MAX_USES]; char *buffers[MAX_USES];
}; };
/** METHOD(options_t, from, bool,
* Defined in header private_options_t *this, char *filename, int *argcp, char **argvp[], int optind)
*/
bool from(private_options_t *this, char *filename, int *argcp, char **argvp[],
int optind)
{ {
int newargc; int newargc;
int next; /* place for next argument */ int next; /* place for next argument */
@ -182,10 +179,8 @@ bool from(private_options_t *this, char *filename, int *argcp, char **argvp[],
return good; return good;
} }
/** METHOD(options_t, destroy, void,
* Defined in header private_options_t *this)
*/
void destroy(private_options_t *this)
{ {
while (this->nuses >= 0) while (this->nuses >= 0)
{ {
@ -200,17 +195,16 @@ void destroy(private_options_t *this)
*/ */
options_t *options_create(void) options_t *options_create(void)
{ {
private_options_t *this = malloc_thing(private_options_t); private_options_t *this;
/* initialize */ INIT(this,
this->newargv = NULL; .public = {
this->room = 0; .from = _from,
this->nuses = -1; .destroy = _destroy,
memset(this->buffers, '\0', MAX_USES);
/* public functions */ },
this->public.from = (bool (*) (options_t*,char*,int*,char***,int))from; .nuses = -1,
this->public.destroy = (void (*) (options_t*))destroy; );
return &this->public; return &this->public;
} }