Changeset eeba011 for variable.c
- Timestamp:
- Jun 27, 2011, 4:28:49 AM (13 years ago)
- 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)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
variable.c
r3dfc083 reeba011 814 814 } 815 815 816 owl_variable *owl_variable_get_var(const owl_vardict *d, const char *name, int require_type) { 816 owl_variable *owl_variable_get_var(const owl_vardict *d, const char *name) 817 { 817 818 owl_variable *v; 818 819 if (!name) return(NULL); 819 820 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; 821 822 return v; 822 823 } 823 824 824 825 /* 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); 826 const void *owl_variable_get(const owl_vardict *d, const char *name) 827 { 828 const owl_variable *v = owl_variable_get_var(d, name); 827 829 if(v == NULL) return NULL; 828 830 return v->get_fn(v); … … 831 833 /* returns a reference */ 832 834 const 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); 834 837 } 835 838 836 839 /* returns a reference */ 837 840 const 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); 839 843 } 840 844 841 845 int 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); 844 848 if (!pi) return(-1); 845 849 return(*pi); … … 847 851 848 852 int 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); 851 855 if (!pi) return(-1); 852 856 return(*pi);
Note: See TracChangeset
for help on using the changeset viewer.