Changeset eeba011 for variable.c


Ignore:
Timestamp:
Jun 27, 2011, 4:28:49 AM (13 years ago)
Author:
Jason Gross <jgross@mit.edu>
Children:
f4e857f
Parents:
3dfc083
git-author:
Jason Gross <jgross@mit.edu> (06/27/11 01:53:42)
git-committer:
Jason Gross <jgross@mit.edu> (06/27/11 04:28:49)
Message:
Drop require_type

It's not doing much for us (and would do even less after the next
commit), and dropping it makes owl_variable_dict_newvar_* a bit more
robust.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • variable.c

    r3dfc083 reeba011  
    814814}
    815815
    816 owl_variable *owl_variable_get_var(const owl_vardict *d, const char *name, int require_type) {
     816owl_variable *owl_variable_get_var(const owl_vardict *d, const char *name)
     817{
    817818  owl_variable *v;
    818819  if (!name) return(NULL);
    819820  v = owl_dict_find_element(d, name);
    820   if (v == NULL || !v->get_fn || v->type != require_type) return(NULL);
     821  if (v == NULL || !v->get_fn) return NULL;
    821822  return v;
    822823}
    823824
    824825/* returns a reference */
    825 const void *owl_variable_get(const owl_vardict *d, const char *name, int require_type) {
    826   owl_variable *v = owl_variable_get_var(d, name, require_type);
     826const void *owl_variable_get(const owl_vardict *d, const char *name)
     827{
     828  const owl_variable *v = owl_variable_get_var(d, name);
    827829  if(v == NULL) return NULL;
    828830  return v->get_fn(v);
     
    831833/* returns a reference */
    832834const char *owl_variable_get_string(const owl_vardict *d, const char *name) {
    833   return owl_variable_get(d,name, OWL_VARIABLE_STRING);
     835  /* XXX TODO: Put type checking back in */
     836  return owl_variable_get(d, name);
    834837}
    835838
    836839/* returns a reference */
    837840const void *owl_variable_get_other(const owl_vardict *d, const char *name) {
    838   return owl_variable_get(d,name, OWL_VARIABLE_OTHER);
     841  /* XXX TODO: Put type checking back in */
     842  return owl_variable_get(d, name);
    839843}
    840844
    841845int owl_variable_get_int(const owl_vardict *d, const char *name) {
    842   const int *pi;
    843   pi = owl_variable_get(d,name,OWL_VARIABLE_INT);
     846  /* XXX TODO: Put type checking back in */
     847  const int *pi = owl_variable_get(d, name);
    844848  if (!pi) return(-1);
    845849  return(*pi);
     
    847851
    848852int owl_variable_get_bool(const owl_vardict *d, const char *name) {
    849   const int *pi;
    850   pi = owl_variable_get(d,name,OWL_VARIABLE_BOOL);
     853  /* XXX TODO: Put type checking back in */
     854  const int *pi = owl_variable_get(d, name);
    851855  if (!pi) return(-1);
    852856  return(*pi);
Note: See TracChangeset for help on using the changeset viewer.