[cairo-commit] pycairo/cairo pycairo-private.h, 1.6,
1.7 pycairo-matrix.c, 1.3, 1.4 pycairo-context.c, 1.12,
1.13 pycairo-font.c, 1.2, 1.3 pycairo-pattern.c, 1.5,
1.6 pycairo-surface.c, 1.5, 1.6
Steve Chaplin
commit at pdx.freedesktop.org
Wed Dec 1 06:44:55 PST 2004
Committed by: stevech1097
Update of /cvs/cairo/pycairo/cairo
In directory gabe:/tmp/cvs-serv1309/cairo
Modified Files:
pycairo-private.h pycairo-matrix.c pycairo-context.c
pycairo-font.c pycairo-pattern.c pycairo-surface.c
Log Message:
SC 01/12/2004
Index: pycairo-private.h
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-private.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- pycairo-private.h 1 Dec 2004 09:29:13 -0000 1.6
+++ pycairo-private.h 1 Dec 2004 14:44:51 -0000 1.7
@@ -57,4 +57,18 @@
PyObject *pycairo_pattern_wrap(cairo_pattern_t *pattern);
PyObject *pycairo_font_new(cairo_font_t *font);
-#endif
+#if PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION < 4
+# define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None
+# define Py_RETURN_TRUE return Py_INCREF(Py_True), Py_True
+# define Py_RETURN_FALSE return Py_INCREF(Py_False), Py_False
+# define Py_CLEAR(op) \
+ do { \
+ if (op) { \
+ PyObject *tmp = (PyObject *)(op); \
+ (op) = NULL; \
+ Py_DECREF(tmp); \
+ } \
+ } while (0)
+#endif /* PY_MAJOR_VERSION */
+
+#endif /* _PYCAIRO_PRIVATE_H_ */
Index: pycairo-matrix.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-matrix.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- pycairo-matrix.c 1 Dec 2004 09:29:13 -0000 1.3
+++ pycairo-matrix.c 1 Dec 2004 14:44:51 -0000 1.4
@@ -110,7 +110,7 @@
if (!PyObject_TypeCheck(other, &PyCairoMatrix_Type) ||
!(op == Py_EQ || op == Py_NE)) {
Py_INCREF(Py_NotImplemented);
- return Py_None;
+ return Py_NotImplemented;
}
cairo_matrix_get_affine(self->matrix, &a1, &b1, &c1, &d1, &tx1, &ty1);
Index: pycairo-context.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-context.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- pycairo-context.c 1 Dec 2004 09:29:13 -0000 1.12
+++ pycairo-context.c 1 Dec 2004 14:44:51 -0000 1.13
@@ -43,12 +43,10 @@
PyCairoContext *self;
self = PyObject_New(PyCairoContext, &PyCairoContext_Type);
- if (!self) {
+ if (self)
+ self->ctx = ctx;
+ else
cairo_destroy(ctx);
- return NULL;
- }
-
- self->ctx = ctx;
return (PyObject *)self;
}
@@ -100,8 +98,7 @@
cairo_copy(self->ctx, src->ctx);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -110,8 +107,7 @@
cairo_save(self->ctx);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -120,8 +116,7 @@
cairo_restore(self->ctx);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -136,8 +131,7 @@
cairo_set_target_surface(self->ctx, surface->surface);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
#if 0
@@ -164,9 +158,7 @@
x_pixels_per_inch, y_pixels_per_inch);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
-
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
#endif /* CAIRO_HAS_PS_SURFACE */
@@ -187,9 +179,7 @@
width, height);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
-
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
#endif /* CAIRO_HAS_PNG_SURFACE */
@@ -204,8 +194,7 @@
cairo_set_operator(self->ctx, op);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -267,8 +256,7 @@
cairo_init_clip(self->ctx);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -282,8 +270,7 @@
cairo_text_path(self->ctx, utf8);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -298,8 +285,7 @@
cairo_set_rgb_color(self->ctx, red, green, blue);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -313,8 +299,7 @@
cairo_set_alpha(self->ctx, alpha);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -329,8 +314,7 @@
cairo_set_pattern(self->ctx, pattern->pattern);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -344,8 +328,7 @@
cairo_set_tolerance(self->ctx, tolerance);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -359,8 +342,7 @@
cairo_set_fill_rule(self->ctx, fill_rule);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -374,8 +356,7 @@
cairo_set_line_width(self->ctx, width);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -389,8 +370,7 @@
cairo_set_line_cap(self->ctx, line_cap);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -404,8 +384,7 @@
cairo_set_line_join(self->ctx, line_join);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -438,9 +417,7 @@
free(dashes);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
-
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -454,8 +431,7 @@
cairo_set_miter_limit(self->ctx, limit);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -469,8 +445,7 @@
cairo_translate(self->ctx, tx, ty);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -484,8 +459,7 @@
cairo_scale(self->ctx, sx, sy);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -499,8 +473,7 @@
cairo_rotate(self->ctx, angle);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -515,8 +488,7 @@
cairo_concat_matrix(self->ctx, matrix->matrix);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -531,8 +503,7 @@
cairo_set_matrix(self->ctx, matrix->matrix);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -541,8 +512,7 @@
cairo_default_matrix(self->ctx);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -551,8 +521,7 @@
cairo_identity_matrix(self->ctx);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -618,8 +587,7 @@
cairo_new_path(self->ctx);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -633,8 +601,7 @@
cairo_move_to(self->ctx, x, y);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -648,8 +615,7 @@
cairo_line_to(self->ctx, x, y);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -664,8 +630,7 @@
cairo_curve_to(self->ctx, x1, y1, x2, y2, x3, y3);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -680,8 +645,7 @@
cairo_arc(self->ctx, xc, yc, radius, angle1, angle2);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -696,8 +660,7 @@
cairo_arc_negative(self->ctx, xc, yc, radius, angle1, angle2);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -711,8 +674,7 @@
cairo_rel_move_to(self->ctx, x, y);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -726,8 +688,7 @@
cairo_rel_line_to(self->ctx, x, y);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -742,8 +703,7 @@
cairo_rel_curve_to(self->ctx, x1, y1, x2, y2, x3, y3);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -758,8 +718,7 @@
cairo_rectangle(self->ctx, x, y, width, height);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -768,8 +727,7 @@
cairo_close_path(self->ctx);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -778,8 +736,7 @@
cairo_stroke(self->ctx);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -788,8 +745,7 @@
cairo_fill(self->ctx);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -798,8 +754,7 @@
cairo_copy_page(self->ctx);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -808,8 +763,7 @@
cairo_show_page(self->ctx);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -818,8 +772,7 @@
cairo_clip(self->ctx);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -836,8 +789,7 @@
cairo_select_font(self->ctx, family, slant, weight);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -851,8 +803,7 @@
cairo_scale_font(self->ctx, scale);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -867,8 +818,7 @@
cairo_transform_font(self->ctx, matrix->matrix);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -882,8 +832,7 @@
cairo_show_text(self->ctx, utf8);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -898,8 +847,7 @@
cairo_set_font(self->ctx, font->font);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -941,8 +889,7 @@
cairo_show_surface(self->ctx, surface->surface, width, height);
if (pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -951,10 +898,9 @@
cairo_font_t *font;
font = cairo_current_font(self->ctx);
- if (!font) {
- Py_INCREF(Py_None);
- return Py_None;
- }
+ if (!font)
+ Py_RETURN_NONE;
+
cairo_font_reference(font);
return pycairo_font_new(font);
}
@@ -1043,10 +989,9 @@
cairo_surface_t *surface;
surface = cairo_current_target_surface(self->ctx);
- if (!surface) {
- Py_INCREF(Py_None);
- return Py_None;
- }
+ if (!surface)
+ Py_RETURN_NONE;
+
cairo_surface_reference(surface);
return pycairo_surface_new(surface);
}
@@ -1059,9 +1004,7 @@
pattern = cairo_current_pattern(self->ctx);
if (pattern)
return pycairo_pattern_wrap(pattern);
-
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
/* struct and wrappers for cairo_current_path() */
@@ -1153,8 +1096,7 @@
cairo_current_path(self->ctx, py_wrapper_move_to, py_wrapper_line_to, py_wrapper_curve_to, py_wrapper_close_path, &callbacks);
if(PyErr_Occurred() || pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -1182,8 +1124,7 @@
cairo_current_path_flat(self->ctx, py_wrapper_move_to, py_wrapper_line_to, py_wrapper_close_path, &callbacks);
if(PyErr_Occurred() || pycairo_check_status(cairo_status(self->ctx)))
return NULL;
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyMethodDef pycairo_methods[] = {
Index: pycairo-font.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-font.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- pycairo-font.c 1 Dec 2004 09:29:13 -0000 1.2
+++ pycairo-font.c 1 Dec 2004 14:44:51 -0000 1.3
@@ -76,8 +76,7 @@
return NULL;
cairo_font_set_transform(self->font, matrix->matrix);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyMethodDef pycairo_font_methods[] = {
Index: pycairo-pattern.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-pattern.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- pycairo-pattern.c 1 Dec 2004 09:29:13 -0000 1.5
+++ pycairo-pattern.c 1 Dec 2004 14:44:51 -0000 1.6
@@ -137,9 +137,7 @@
blue, alpha);
if (pycairo_check_status(status))
return NULL;
-
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -153,8 +151,7 @@
/* always returns status = success */
cairo_pattern_set_matrix(self->pattern, matrix->matrix);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -167,8 +164,7 @@
/* always returns status = success */
cairo_pattern_set_extend(self->pattern, extend);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -181,8 +177,7 @@
/* always returns status = success */
cairo_pattern_set_filter(self->pattern, filter);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
Index: pycairo-surface.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-surface.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- pycairo-surface.c 1 Dec 2004 09:29:13 -0000 1.5
+++ pycairo-surface.c 1 Dec 2004 14:44:51 -0000 1.6
@@ -93,8 +93,7 @@
return NULL;
cairo_surface_set_repeat(self->surface, repeat);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -107,8 +106,7 @@
return NULL;
cairo_surface_set_matrix(self->surface, matrix->matrix);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyObject *
@@ -139,8 +137,7 @@
return NULL;
cairo_surface_set_filter(self->surface, filter);
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
static PyMethodDef pycairo_surface_methods[] = {
More information about the cairo-commit
mailing list