@@ -35,18 +35,6 @@ static union Sass_Value* _error_to_sass_value(PyObject* value);
3535static union Sass_Value* _unknown_type_to_sass_error (PyObject* value);
3636static union Sass_Value* _exception_to_sass_error ();
3737
38- struct PySass_Pair {
39- char *label;
40- int value;
41- };
42-
43- static struct PySass_Pair PySass_output_style_enum[] = {
44- {(char *) " nested" , SASS_STYLE_NESTED},
45- {(char *) " expanded" , SASS_STYLE_EXPANDED},
46- {(char *) " compact" , SASS_STYLE_COMPACT},
47- {(char *) " compressed" , SASS_STYLE_COMPRESSED},
48- {NULL }
49- };
5038
5139static PyObject* _to_py_value (const union Sass_Value* value) {
5240 PyObject* retv = NULL ;
@@ -522,22 +510,17 @@ static PyMethodDef PySass_methods[] = {
522510
523511static char PySass_doc[] = " The thin binding of libsass for Python." ;
524512
525- void PySass_make_enum_dict (PyObject *enum_dict, struct PySass_Pair *pairs) {
526- size_t i;
527- for (i = 0 ; pairs[i].label ; ++i) {
528- PyDict_SetItemString (
529- enum_dict,
530- pairs[i].label ,
531- PySass_Int_FromLong ((long ) pairs[i].value )
532- );
533- }
513+ PyObject* PySass_make_enum_dict () {
514+ PyObject* dct = PyDict_New ();
515+ PyDict_SetItemString (dct, " nested" , PySass_Int_FromLong (SASS_STYLE_NESTED));
516+ PyDict_SetItemString (dct, " expected" , PySass_Int_FromLong (SASS_STYLE_EXPANDED));
517+ PyDict_SetItemString (dct, " compact" , PySass_Int_FromLong (SASS_STYLE_COMPACT));
518+ PyDict_SetItemString (dct, " compressed" , PySass_Int_FromLong (SASS_STYLE_COMPRESSED));
519+ return dct;
534520}
535521
536522void PySass_init_module (PyObject *module ) {
537- PyObject *output_styles;
538- output_styles = PyDict_New ();
539- PySass_make_enum_dict (output_styles, PySass_output_style_enum);
540- PyModule_AddObject (module , " OUTPUT_STYLES" , output_styles);
523+ PyModule_AddObject (module , " OUTPUT_STYLES" , PySass_make_enum_dict ());
541524}
542525
543526#if PY_MAJOR_VERSION >= 3
0 commit comments