@@ -35,18 +35,6 @@ static union Sass_Value* _error_to_sass_value(PyObject* value);
35
35
static union Sass_Value* _unknown_type_to_sass_error (PyObject* value);
36
36
static union Sass_Value* _exception_to_sass_error ();
37
37
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
- };
50
38
51
39
static PyObject* _to_py_value (const union Sass_Value* value) {
52
40
PyObject* retv = NULL ;
@@ -522,22 +510,17 @@ static PyMethodDef PySass_methods[] = {
522
510
523
511
static char PySass_doc[] = " The thin binding of libsass for Python." ;
524
512
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;
534
520
}
535
521
536
522
void 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 ());
541
524
}
542
525
543
526
#if PY_MAJOR_VERSION >= 3
0 commit comments