~ubuntu-branches/ubuntu/quantal/ruby1.9.1/quantal

« back to all changes in this revision

Viewing changes to struct.c

  • Committer: Bazaar Package Importer
  • Author(s): Lucas Nussbaum
  • Date: 2011-09-24 19:16:17 UTC
  • mfrom: (1.1.8 upstream) (13.1.7 experimental)
  • Revision ID: james.westby@ubuntu.com-20110924191617-o1qz4rcmqjot8zuy
Tags: 1.9.3~rc1-1
* New upstream release: 1.9.3 RC1.
  + Includes load.c fixes. Closes: #639959.
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
  struct.c -
4
4
 
5
 
  $Author: marcandre $
 
5
  $Author: nobu $
6
6
  created at: Tue Mar 22 18:44:30 JST 1995
7
7
 
8
8
  Copyright (C) 1993-2007 Yukihiro Matsumoto
10
10
**********************************************************************/
11
11
 
12
12
#include "ruby/ruby.h"
 
13
#include "internal.h"
13
14
 
14
15
VALUE rb_cStruct;
15
16
static ID id_members;
151
152
static void
152
153
rb_struct_modify(VALUE s)
153
154
{
154
 
    if (OBJ_FROZEN(s)) rb_error_frozen("Struct");
 
155
    rb_check_frozen(s);
155
156
    if (!OBJ_UNTRUSTED(s) && rb_safe_level() >= 4)
156
157
       rb_raise(rb_eSecurityError, "Insecure: can't modify Struct");
157
158
}
240
241
    VALUE klass;
241
242
    va_list ar;
242
243
    VALUE members;
243
 
    long i;
244
244
    char *name;
245
245
 
246
246
    members = rb_ary_new2(0);
247
247
    va_start(ar, alloc);
248
 
    i = 0;
249
248
    while ((name = va_arg(ar, char*)) != NULL) {
250
249
        rb_ary_push(members, ID2SYM(rb_intern(name)));
251
250
    }