mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Added rb_secure(4). (Thanks to Minero Aoki)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e5282ef182
commit
ab7dac4027
4 changed files with 23 additions and 1 deletions
|
@ -1,3 +1,11 @@
|
|||
Mon Mar 24 16:55:04 2003 Takaaki Tateishi <ttate@ttsky.net>
|
||||
|
||||
* ext/dl/dl.c: added rb_secure(4). (Thanks to Minero Aoki)
|
||||
|
||||
* ext/dl/sym.c: ditto.
|
||||
|
||||
* ext/dl/ptr.c: ditto.
|
||||
|
||||
Mon Mar 24 00:09:02 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
||||
|
||||
* parse.y (block_append): warn unused literal.
|
||||
|
|
|
@ -542,18 +542,21 @@ rb_io_to_ptr(VALUE self)
|
|||
VALUE
|
||||
rb_dl_dlopen(int argc, VALUE argv[], VALUE self)
|
||||
{
|
||||
rb_secure(4);
|
||||
return rb_class_new_instance(argc, argv, rb_cDLHandle);
|
||||
}
|
||||
|
||||
VALUE
|
||||
rb_dl_malloc(VALUE self, VALUE size)
|
||||
{
|
||||
rb_secure(4);
|
||||
return rb_dlptr_malloc(DLNUM2LONG(size), dlfree);
|
||||
}
|
||||
|
||||
VALUE
|
||||
rb_dl_strdup(VALUE self, VALUE str)
|
||||
{
|
||||
rb_secure(4);
|
||||
str = rb_String(str);
|
||||
return rb_dlptr_new(strdup(RSTRING(str)->ptr), RSTRING(str)->len, dlfree);
|
||||
}
|
||||
|
@ -561,6 +564,7 @@ rb_dl_strdup(VALUE self, VALUE str)
|
|||
static VALUE
|
||||
rb_dl_sizeof(VALUE self, VALUE str)
|
||||
{
|
||||
rb_secure(4);
|
||||
return INT2NUM(dlsizeof(StringValuePtr(str)));
|
||||
}
|
||||
|
||||
|
@ -571,6 +575,7 @@ rb_dl_callback(int argc, VALUE argv[], VALUE self)
|
|||
int rettype, entry, i;
|
||||
char fname[127];
|
||||
|
||||
rb_secure(4);
|
||||
proc = Qnil;
|
||||
switch( rb_scan_args(argc, argv, "11", &type, &proc) ){
|
||||
case 1:
|
||||
|
@ -636,9 +641,11 @@ rb_dl_callback(int argc, VALUE argv[], VALUE self)
|
|||
static VALUE
|
||||
rb_dl_remove_callback(VALUE mod, VALUE sym)
|
||||
{
|
||||
freefunc_t f = rb_dlsym2csym(sym);
|
||||
freefunc_t f;
|
||||
int i, j;
|
||||
|
||||
rb_secure(4);
|
||||
f = rb_dlsym2csym(sym);
|
||||
for( i=0; i < CALLBACK_TYPES; i++ ){
|
||||
for( j=0; j < MAX_CALLBACK; j++ ){
|
||||
if( rb_dl_callback_table[i][j] == f ){
|
||||
|
|
|
@ -26,6 +26,7 @@ rb_hash_delete(VALUE hash, VALUE key)
|
|||
static void
|
||||
rb_dlmem_delete(void *ptr)
|
||||
{
|
||||
rb_secure(4);
|
||||
rb_hash_delete(DLMemoryTable, DLLONG2NUM(ptr));
|
||||
}
|
||||
|
||||
|
@ -89,6 +90,7 @@ rb_dlptr_new2(VALUE klass, void *ptr, long size, freefunc_t func)
|
|||
struct ptr_data *data;
|
||||
VALUE val;
|
||||
|
||||
rb_secure(4);
|
||||
if( ptr ){
|
||||
val = rb_dlmem_aref(ptr);
|
||||
if( val == Qnil ){
|
||||
|
@ -130,6 +132,7 @@ rb_dlptr_malloc(long size, freefunc_t func)
|
|||
{
|
||||
void *ptr;
|
||||
|
||||
rb_secure(4);
|
||||
ptr = dlmalloc((size_t)size);
|
||||
memset(ptr,0,(size_t)size);
|
||||
return rb_dlptr_new(ptr, size, func);
|
||||
|
@ -161,6 +164,7 @@ rb_dlptr_s_allocate(VALUE klass)
|
|||
VALUE obj;
|
||||
struct ptr_data *data;
|
||||
|
||||
rb_secure(4);
|
||||
obj = Data_Make_Struct(klass, struct ptr_data, 0, dlptr_free, data);
|
||||
data->ptr = 0;
|
||||
data->free = 0;
|
||||
|
@ -850,6 +854,7 @@ rb_dlptr_aset(int argc, VALUE argv[], VALUE self)
|
|||
long memsize;
|
||||
void *memimg;
|
||||
|
||||
rb_secure(4);
|
||||
switch( rb_scan_args(argc, argv, "21", &key, &num, &val) ){
|
||||
case 2:
|
||||
val = num;
|
||||
|
|
|
@ -77,6 +77,7 @@ rb_dlsym_new(void (*func)(), const char *name, const char *type)
|
|||
struct sym_data *data;
|
||||
const char *ptype;
|
||||
|
||||
rb_secure(4);
|
||||
if( !type || !type[0] ){
|
||||
return rb_dlptr_new((void*)func, 0, 0);
|
||||
}
|
||||
|
@ -329,6 +330,7 @@ rb_dlsym_call(int argc, VALUE argv[], VALUE self)
|
|||
long ftype;
|
||||
void *func;
|
||||
|
||||
rb_secure(4);
|
||||
Data_Get_Struct(self, struct sym_data, sym);
|
||||
DEBUG_CODE({
|
||||
printf("rb_dlsym_call(): type = '%s', func = 0x%x\n", sym->type, sym->func);
|
||||
|
|
Loading…
Reference in a new issue