Skip to content

Commit d33cc53

Browse files
committed
* node.h (struct rb_thread.locals): explicit as struct.
[ruby-core:10585] * eval.c, node.h (enum rb_thread_status, struct rb_thread, rb_curr_thread, rb_main_thread): prefixed. [ruby-core:10586] * file.c (chompdirsep): made an unprefixed name static. * io.c (io_fread): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12127 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 2898d5c commit d33cc53

File tree

5 files changed

+39
-26
lines changed

5 files changed

+39
-26
lines changed

ChangeLog

+12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
Sat Mar 24 23:40:29 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
2+
3+
* node.h (struct rb_thread.locals): explicit as struct.
4+
[ruby-core:10585]
5+
6+
* eval.c, node.h (enum rb_thread_status, struct rb_thread,
7+
rb_curr_thread, rb_main_thread): prefixed. [ruby-core:10586]
8+
9+
* file.c (chompdirsep): made an unprefixed name static.
10+
11+
* io.c (io_fread): ditto.
12+
113
Sat Mar 24 01:54:03 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
214

315
* eval.c (ruby_cleanup): exit by SystemExit and SignalException in END

eval.c

+13-12
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,8 @@ static int scope_vmode;
243243
#define SCOPE_SET(f) (scope_vmode=(f))
244244
#define SCOPE_TEST(f) (scope_vmode&(f))
245245

246-
VALUE (*ruby_sandbox_save)(struct thread *) = NULL;
247-
VALUE (*ruby_sandbox_restore)(struct thread *) = NULL;
246+
VALUE (*ruby_sandbox_save)_((rb_thread_t));
247+
VALUE (*ruby_sandbox_restore)_((rb_thread_t));
248248
NODE* ruby_current_node;
249249
int ruby_safe_level = 0;
250250
/* safe-level:
@@ -1073,8 +1073,11 @@ NODE *ruby_top_cref;
10731073
ruby_scope = _scope; \
10741074
scope_vmode = SCOPE_PUBLIC
10751075

1076-
rb_thread_t curr_thread = 0;
1077-
rb_thread_t main_thread;
1076+
rb_thread_t rb_curr_thread;
1077+
rb_thread_t rb_main_thread;
1078+
#define main_thread rb_main_thread
1079+
#define curr_thread rb_curr_thread
1080+
10781081
static void scope_dup _((struct SCOPE *));
10791082

10801083
#define POP_SCOPE() \
@@ -9832,8 +9835,6 @@ extern VALUE rb_last_status;
98329835
# endif
98339836
#endif
98349837

9835-
/* typedef struct thread * rb_thread_t; */
9836-
98379838
#define THREAD_RAISED 0x200 /* temporary flag */
98389839
#define THREAD_TERMINATING 0x400 /* persistent flag */
98399840
#define THREAD_NO_ENSURE 0x800 /* persistent flag */
@@ -9856,7 +9857,7 @@ struct thread_status_t {
98569857

98579858
int safe;
98589859

9859-
enum thread_status status;
9860+
enum rb_thread_status status;
98609861
int wait_for;
98619862
int fd;
98629863
fd_set readfds;
@@ -9958,7 +9959,7 @@ rb_trap_eval(cmd, sig, safe)
99589959

99599960
static const char *
99609961
thread_status_name(status)
9961-
enum thread_status status;
9962+
enum rb_thread_status status;
99629963
{
99639964
switch (status) {
99649965
case THREAD_RUNNABLE:
@@ -11016,7 +11017,7 @@ rb_thread_join(th, limit)
1101611017
rb_thread_t th;
1101711018
double limit;
1101811019
{
11019-
enum thread_status last_status = THREAD_RUNNABLE;
11020+
enum rb_thread_status last_status = THREAD_RUNNABLE;
1102011021

1102111022
if (rb_thread_critical) rb_thread_deadlock();
1102211023
if (!rb_thread_dead(th)) {
@@ -11399,7 +11400,7 @@ rb_thread_pass()
1139911400
VALUE
1140011401
rb_thread_stop()
1140111402
{
11402-
enum thread_status last_status = THREAD_RUNNABLE;
11403+
enum rb_thread_status last_status = THREAD_RUNNABLE;
1140311404

1140411405
rb_thread_critical = 0;
1140511406
if (curr_thread == curr_thread->next) {
@@ -11663,7 +11664,7 @@ rb_thread_group(thread)
1166311664
#endif
1166411665

1166511666
#define THREAD_ALLOC(th) do {\
11666-
th = ALLOC(struct thread);\
11667+
th = ALLOC(struct rb_thread);\
1166711668
\
1166811669
th->next = 0;\
1166911670
th->prev = 0;\
@@ -11828,7 +11829,7 @@ rb_thread_start_0(fn, arg, th)
1182811829
volatile rb_thread_t th_save = th;
1182911830
volatile VALUE thread = th->thread;
1183011831
struct BLOCK *volatile saved_block = 0;
11831-
enum thread_status status;
11832+
enum rb_thread_status status;
1183211833
int state;
1183311834

1183411835
if (OBJ_FROZEN(curr_thread->thgroup)) {

file.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2433,7 +2433,7 @@ rb_path_last_separator(path)
24332433
return last;
24342434
}
24352435

2436-
char *
2436+
static char *
24372437
chompdirsep(path)
24382438
const char *path;
24392439
{

io.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,7 @@ read_buffered_data(ptr, len, f)
10521052
#endif
10531053
}
10541054

1055-
long
1055+
static long
10561056
io_fread(ptr, len, fptr)
10571057
char *ptr;
10581058
long len;

node.h

+12-12
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,8 @@ extern NODE *ruby_top_cref;
338338
#define NOEX_PUBLIC 0
339339
#define NOEX_NOSUPER 1
340340
#define NOEX_PRIVATE 2
341-
#define NOEX_PROTECTED 4
342-
#define NOEX_MASK 6
341+
#define NOEX_PROTECTED 4
342+
#define NOEX_MASK 6
343343

344344
#define NOEX_UNDEF NOEX_NOSUPER
345345

@@ -390,17 +390,17 @@ typedef struct {
390390
typedef jmp_buf rb_jmpbuf_t;
391391
#endif
392392

393-
enum thread_status {
393+
enum rb_thread_status {
394394
THREAD_TO_KILL,
395395
THREAD_RUNNABLE,
396396
THREAD_STOPPED,
397397
THREAD_KILLED,
398398
};
399399

400-
typedef struct thread * rb_thread_t;
400+
typedef struct rb_thread *rb_thread_t;
401401

402-
struct thread {
403-
struct thread *next, *prev;
402+
struct rb_thread {
403+
rb_thread_t next, prev;
404404
rb_jmpbuf_t context;
405405
#if (defined _WIN32 && !defined _WIN32_WCE) || defined __CYGWIN__
406406
unsigned long win32_exception_list;
@@ -441,7 +441,7 @@ struct thread {
441441

442442
int safe;
443443

444-
enum thread_status status;
444+
enum rb_thread_status status;
445445
int wait_for;
446446
int fd;
447447
fd_set readfds;
@@ -455,17 +455,17 @@ struct thread {
455455
int priority;
456456
VALUE thgroup;
457457

458-
st_table *locals;
458+
struct st_table *locals;
459459

460460
VALUE thread;
461461

462462
VALUE sandbox;
463463
};
464464

465-
extern VALUE (*ruby_sandbox_save)(struct thread *);
466-
extern VALUE (*ruby_sandbox_restore)(struct thread *);
467-
extern rb_thread_t curr_thread;
468-
extern rb_thread_t main_thread;
465+
extern VALUE (*ruby_sandbox_save)_((rb_thread_t));
466+
extern VALUE (*ruby_sandbox_restore)_((rb_thread_t));
467+
extern rb_thread_t rb_curr_thread;
468+
extern rb_thread_t rb_main_thread;
469469

470470
#if defined(__cplusplus)
471471
} /* extern "C" { */

0 commit comments

Comments
 (0)