Bug 3469 - Add pycairo_context_get utility macro
Summary: Add pycairo_context_get utility macro
Status: RESOLVED FIXED
Alias: None
Product: pycairo
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Linux (All)
: high normal
Assignee: Steve Chaplin
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-04 07:31 UTC by Gustavo J. A. M. Carneiro
Modified: 2005-06-05 09:56 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Gustavo J. A. M. Carneiro 2005-06-04 07:31:30 UTC
I find this macro most useful.  Can we add it to pycairo.h?

#define pycairo_context_get(obj)    (((PycairoContext *)obj)->ctx)
Comment 1 Steve Chaplin 2005-06-05 20:59:39 UTC
I've added:
#define PycairoContext_GET(obj)    (((PycairoContext *)(obj))->ctx)

Added an extra "()" round obj, changed pycairo_context to one word, and
used some uppercase - I've been following the PEP 7 "Style Guide for C code",
where it suggests:

    - Public functions and variables use MixedCase with underscores,
      like this: PyObject_GetAttr, Py_BuildValue, PyExc_TypeError.

    - Macros should have a MixedCase prefix and then use upper case,
      for example: PyString_AS_STRING, Py_PRINT_RAW.
Comment 2 Gustavo J. A. M. Carneiro 2005-06-06 02:56:33 UTC
Cool :-)


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.