Skip to content

Commit c1d3a8e

Browse files
committed
Deprecate names under Struct
1 parent 45a6a2f commit c1d3a8e

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

ext/etc/etc.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ char *getlogin();
5454

5555
#define RUBY_ETC_VERSION "1.1.0"
5656

57+
#ifndef HAVE_RB_DEPRECATE_CONSTANT
58+
# define rb_deprecate_constant(mod,name) ((void)(mod),(void)(name))
59+
#endif
60+
5761
#include "constdefs.h"
5862

5963
/* call-seq:
@@ -1165,6 +1169,7 @@ Init_etc(void)
11651169
rb_define_const(mEtc, "Passwd", sPasswd);
11661170
#endif
11671171
rb_define_const(rb_cStruct, "Passwd", sPasswd); /* deprecated name */
1172+
rb_deprecate_constant(rb_cStruct, "Passwd");
11681173
rb_extend_object(sPasswd, rb_mEnumerable);
11691174
rb_define_singleton_method(sPasswd, "each", etc_each_passwd, 0);
11701175

@@ -1200,6 +1205,7 @@ Init_etc(void)
12001205
rb_define_const(mEtc, "Group", sGroup);
12011206
#endif
12021207
rb_define_const(rb_cStruct, "Group", sGroup); /* deprecated name */
1208+
rb_deprecate_constant(rb_cStruct, "Group");
12031209
rb_extend_object(sGroup, rb_mEnumerable);
12041210
rb_define_singleton_method(sGroup, "each", etc_each_group, 0);
12051211
#endif

ext/etc/extconf.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
%x[#{RbConfig.ruby} #{srcdir}/mkconstants.rb -o #{srcdir}/constdefs.h]
4848
end
4949

50+
have_func("rb_deprecate_constant")
51+
5052
$distcleanfiles << "constdefs.h"
5153

5254
create_makefile("etc")

0 commit comments

Comments
 (0)