Bug 3469

Summary: Add pycairo_context_get utility macro
Product: pycairo Reporter: Gustavo J. A. M. Carneiro <gjc>
Component: generalAssignee: Steve Chaplin <d74n5pohf9>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: high    
Version: unspecified   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

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.