Permalink
Browse files

Add rm_ prefix to all external identifiers that start with ID_ to

prevent name collisions with other libraries. (bug #8927)
  • Loading branch information...
1 parent af4a597 commit fb4c4811e75a1407899e4a1c9535d90fdbb7df93 rmagick committed Mar 4, 2007
Showing with 420 additions and 136 deletions.
  1. +28 −28 ext/RMagick/rmagick.h
  2. +63 −8 ext/RMagick/rmdraw.c
  3. +4 −4 ext/RMagick/rmilist.c
  4. +12 −12 ext/RMagick/rmimage.c
  5. +11 −11 ext/RMagick/rminfo.c
  6. +263 −34 ext/RMagick/rmmain.c
  7. +39 −39 ext/RMagick/rmutil.c
View
@@ -1,4 +1,4 @@
-/* $Id: rmagick.h,v 1.152.2.1 2007/02/04 13:13:33 rmagick Exp $ */
+/* $Id: rmagick.h,v 1.152.2.2 2007/03/04 00:05:27 rmagick Exp $ */
/*=============================================================================
| Copyright (C) 2006 by Timothy P. Hunter
| Name: rmagick.h
@@ -332,29 +332,29 @@ EXTERN VALUE Class_VirtualPixelMethod;
/*
* Commonly-used IDs
*/
-EXTERN ID ID__dummy_img_; // "_dummy_img_"
-EXTERN ID ID_call; // "call"
-EXTERN ID ID_changed; // "changed"
-EXTERN ID ID_cur_image; // "cur_image"
-EXTERN ID ID_dup; // "dup"
-EXTERN ID ID_enumerators; // "enumerators"
-EXTERN ID ID_fill; // "fill"
-EXTERN ID ID_flag; // "flag"
-EXTERN ID ID_from_s; // "from_s"
-EXTERN ID ID_Geometry; // "Geometry"
-EXTERN ID ID_GeometryValue; // "GeometryValue"
-EXTERN ID ID_height; // "height"
-EXTERN ID ID_initialize_copy; // "initialize_copy"
-EXTERN ID ID_length; // "length"
-EXTERN ID ID_notify_observers; // "notify_observers"
-EXTERN ID ID_new; // "new"
-EXTERN ID ID_push; // "push"
-EXTERN ID ID_spaceship; // "<=>
-EXTERN ID ID_to_s; // "to_s"
-EXTERN ID ID_values; // "values"
-EXTERN ID ID_width; // "width"
-EXTERN ID ID_x; // "x"
-EXTERN ID ID_y; // "y"
+EXTERN ID rm_ID__dummy_img_; // "_dummy_img_"
+EXTERN ID rm_ID_call; // "call"
+EXTERN ID rm_ID_changed; // "changed"
+EXTERN ID rm_ID_cur_image; // "cur_image"
+EXTERN ID rm_ID_dup; // "dup"
+EXTERN ID rm_ID_enumerators; // "enumerators"
+EXTERN ID rm_ID_fill; // "fill"
+EXTERN ID rm_ID_flag; // "flag"
+EXTERN ID rm_ID_from_s; // "from_s"
+EXTERN ID rm_ID_Geometry; // "Geometry"
+EXTERN ID rm_ID_GeometryValue; // "GeometryValue"
+EXTERN ID rm_ID_height; // "height"
+EXTERN ID rm_ID_initialize_copy; // "initialize_copy"
+EXTERN ID rm_ID_length; // "length"
+EXTERN ID rm_ID_notify_observers; // "notify_observers"
+EXTERN ID rm_ID_new; // "new"
+EXTERN ID rm_ID_push; // "push"
+EXTERN ID rm_ID_spaceship; // "<=>
+EXTERN ID rm_ID_to_s; // "to_s"
+EXTERN ID rm_ID_values; // "values"
+EXTERN ID rm_ID_width; // "width"
+EXTERN ID rm_ID_x; // "x"
+EXTERN ID rm_ID_y; // "y"
#define min(a,b) ((a)<(b)?(a):(b))
@@ -480,8 +480,8 @@ Pixel_##_channel_##_eq(VALUE self, VALUE v) \
rm_check_frozen(self); \
Data_Get_Struct(self, Pixel, pixel); \
pixel->_channel_ = (Quantum) NUM2UINT(v); \
- (void) rb_funcall(self, ID_changed, 0); \
- (void) rb_funcall(self, ID_notify_observers, 1, self); \
+ (void) rb_funcall(self, rm_ID_changed, 0); \
+ (void) rb_funcall(self, rm_ID_notify_observers, 1, self); \
return UINT2NUM((unsigned int)(pixel->_channel_)); \
}
@@ -498,8 +498,8 @@ Pixel_##_cmyk_channel_##_eq(VALUE self, VALUE v) \
rm_check_frozen(self); \
Data_Get_Struct(self, Pixel, pixel); \
pixel->_rgb_channel_ = (Quantum) NUM2UINT(v); \
- (void) rb_funcall(self, ID_changed, 0); \
- (void) rb_funcall(self, ID_notify_observers, 1, self); \
+ (void) rb_funcall(self, rm_ID_changed, 0); \
+ (void) rb_funcall(self, rm_ID_notify_observers, 1, self); \
return UINT2NUM((unsigned int)pixel->_rgb_channel_); \
} \
\
View
@@ -1,4 +1,4 @@
-/* $Id: rmdraw.c,v 1.44 2007/01/25 00:26:44 rmagick Exp $ */
+/* $Id: rmdraw.c,v 1.43.2.1 2007/03/04 00:05:30 rmagick Exp $ */
/*============================================================================\
| Copyright (C) 2007 by Timothy P. Hunter
| Name: rmdraw.c
@@ -678,7 +678,7 @@ Draw_dup(VALUE self)
{
(void)rb_obj_taint(dup);
}
- return rb_funcall(dup, ID_initialize_copy, 1, self);
+ return rb_funcall(dup, rm_ID_initialize_copy, 1, self);
}
@@ -779,7 +779,11 @@ Draw_inspect(VALUE self)
Raises: ImageMagickError if no memory
*/
+#if defined(HAVE_RB_DEFINE_ALLOC_FUNC)
VALUE Draw_alloc(VALUE class)
+#else
+VALUE Draw_new(VALUE class)
+#endif
{
Draw *draw;
volatile VALUE draw_obj;
@@ -788,6 +792,10 @@ VALUE Draw_alloc(VALUE class)
memset(draw, 0, sizeof(Draw));
draw_obj = Data_Wrap_Struct(class, mark_Draw, destroy_Draw, draw);
+#if !defined(HAVE_RB_DEFINE_ALLOC_FUNC)
+ rb_obj_call_init(draw_obj, 0, NULL);
+#endif
+
return draw_obj;
}
@@ -866,7 +874,11 @@ destroy_Draw(void *drawptr)
*/
static VALUE new_DrawOptions(void)
{
+#if defined(HAVE_RB_DEFINE_ALLOC_FUNC)
return DrawOptions_initialize(Draw_alloc(Class_DrawOptions));
+#else
+ return DrawOptions_new(Class_DrawOptions);
+#endif
}
@@ -877,7 +889,11 @@ static VALUE new_DrawOptions(void)
Notes: The DrawOptions class is the same as the Draw class except
is has only the attribute writer functions.
*/
+#if defined(HAVE_RB_DEFINE_ALLOC_FUNC)
VALUE DrawOptions_alloc(VALUE class)
+#else
+VALUE DrawOptions_new(VALUE class)
+#endif
{
Draw *draw_options;
volatile VALUE draw_options_obj;
@@ -886,6 +902,10 @@ VALUE DrawOptions_alloc(VALUE class)
memset(draw_options, 0, sizeof(Draw));
draw_options_obj = Data_Wrap_Struct(class, mark_Draw, destroy_Draw, draw_options);
+#if !defined(HAVE_RB_DEFINE_ALLOC_FUNC)
+ rb_obj_call_init(draw_options_obj, 0, NULL);
+#endif
+
return draw_options_obj;
}
@@ -1030,7 +1050,7 @@ Montage_frame_eq(VALUE self, VALUE frame_arg)
volatile VALUE frame;
Data_Get_Struct(self, Montage, montage);
- frame = rb_funcall(frame_arg, ID_to_s, 0);
+ frame = rb_funcall(frame_arg, rm_ID_to_s, 0);
magick_clone_string(&montage->info->frame, STRING_PTR(frame));
return self;
@@ -1047,7 +1067,7 @@ Montage_geometry_eq(VALUE self, VALUE geometry_arg)
volatile VALUE geometry;
Data_Get_Struct(self, Montage, montage);
- geometry = rb_funcall(geometry_arg, ID_to_s, 0);
+ geometry = rb_funcall(geometry_arg, rm_ID_to_s, 0);
magick_clone_string(&montage->info->geometry, STRING_PTR(geometry));
return self;
@@ -1097,7 +1117,11 @@ Montage_matte_color_eq(VALUE self, VALUE color)
Purpose: Create a new Montage object
*/
VALUE
+#if defined(HAVE_RB_DEFINE_ALLOC_FUNC)
Montage_alloc(VALUE class)
+#else
+Montage_new(VALUE class)
+#endif
{
MontageInfo *montage_info;
Montage *montage;
@@ -1124,6 +1148,10 @@ Montage_alloc(VALUE class)
montage->compose = OverCompositeOp;
montage_obj = Data_Wrap_Struct(class, NULL, destroy_Montage, montage);
+#if !defined(HAVE_RB_DEFINE_ALLOC_FUNC)
+ (void) rb_obj_call_init(montage_obj, 0, NULL);
+#endif
+
return montage_obj;
}
@@ -1134,7 +1162,11 @@ Montage_alloc(VALUE class)
VALUE rm_montage_new(void)
{
+#if defined(HAVE_RB_DEFINE_ALLOC_FUNC)
return Montage_initialize(Montage_alloc(Class_Montage));
+#else
+ return Montage_new(Class_Montage);
+#endif
}
/*
@@ -1243,7 +1275,7 @@ Montage_tile_eq(VALUE self, VALUE tile_arg)
volatile VALUE tile;
Data_Get_Struct(self, Montage, montage);
- tile = rb_funcall(tile_arg, ID_to_s, 0);
+ tile = rb_funcall(tile_arg, rm_ID_to_s, 0);
magick_clone_string(&montage->info->tile, STRING_PTR(tile));
return self;
@@ -1293,6 +1325,24 @@ PolaroidOptions_alloc(VALUE class)
/*
+ Method: PolaroidOptions.new
+ Purpose: Ruby 1.6 singleton function to allocate and init a PolaroidOptions
+ object
+*/
+#if !defined(HAVE_RB_DEFINE_ALLOC_FUNC)
+VALUE PolaroidOptions_new(VALUE class)
+{
+ volatile VALUE polaroid_obj;
+
+ polaroid_obj = PolaroidOptions_alloc(class);
+ rb_obj_call_init(polaroid_obj, 0, NULL);
+
+ return polaroid_obj;
+}
+#endif
+
+
+/*
Method: Magick::PolaroidOptions#initialize
Purpose: Yield to an optional block
*/
@@ -1325,7 +1375,11 @@ PolaroidOptions_initialize(VALUE self)
*/
VALUE rm_polaroid_new(void)
{
+#if defined(HAVE_RB_DEFINE_ALLOC_FUNC)
return PolaroidOptions_initialize(PolaroidOptions_alloc(Class_PolaroidOptions));
+#else
+ return PolaroidOptions_new(Class_PolaroidOptions);
+#endif
}
@@ -1349,7 +1403,7 @@ static VALUE get_dummy_tm_img(VALUE klass)
Info *info;
Image *image;
- if (rb_cvar_defined(klass, ID__dummy_img_) != Qtrue)
+ if (rb_cvar_defined(klass, rm_ID__dummy_img_) != Qtrue)
{
info = CloneImageInfo(NULL);
@@ -1365,9 +1419,10 @@ static VALUE get_dummy_tm_img(VALUE klass)
(void) DestroyImageInfo(info);
dummy_img = rm_image_new(image);
- rb_cvar_set(klass, ID__dummy_img_, dummy_img, 0);
+ RUBY18(rb_cvar_set(klass, rm_ID__dummy_img_, dummy_img, 0));
+ RUBY16(rb_cvar_set(klass, rm_ID__dummy_img_, dummy_img));
}
- dummy_img = rb_cvar_get(klass, ID__dummy_img_);
+ dummy_img = rb_cvar_get(klass, rm_ID__dummy_img_);
return dummy_img;
}
@@ -1,4 +1,4 @@
-/* $Id: rmilist.c,v 1.46 2007/01/12 00:11:16 rmagick Exp $ */
+/* $Id: rmilist.c,v 1.46.2.1 2007/03/04 00:05:34 rmagick Exp $ */
/*============================================================================\
| Copyright (C) 2007 by Timothy P. Hunter
| Name: rmilist.c
@@ -493,7 +493,7 @@ ImageList_optimize_layers(VALUE self, VALUE method)
VALUE
rm_imagelist_new()
{
- return rb_funcall(Class_ImageList, ID_new, 0);
+ return rb_funcall(Class_ImageList, rm_ID_new, 0);
}
@@ -579,7 +579,7 @@ rm_imagelist_length(VALUE imagelist)
{
volatile VALUE len;
- len = rb_funcall(imagelist, ID_length, 0);
+ len = rb_funcall(imagelist, rm_ID_length, 0);
return FIX2INT(len);
}
@@ -591,7 +591,7 @@ void
rm_imagelist_push(VALUE imagelist, VALUE image)
{
rm_check_frozen(imagelist);
- (void) rb_funcall(imagelist, ID_push, 1, image);
+ (void) rb_funcall(imagelist, rm_ID_push, 1, image);
}
/*
Oops, something went wrong.

0 comments on commit fb4c481

Please sign in to comment.