Skip to content

Commit

Permalink
* regex.c (mbc_startpos_func): VC6 seems to be unable to
Browse files Browse the repository at this point in the history
  understand forward declaration for static variables.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nobu committed Mar 25, 2002
1 parent 6dfd299 commit 40ceea0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
5 changes: 4 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
Mon Mar 25 17:18:48 2002 Nobuyoshi Nakada <[email protected]>
Mon Mar 25 17:49:41 2002 Nobuyoshi Nakada <[email protected]>

* regex.c (mbc_startpos_func): VC6 seems to be unable to
understand forward declaration for static variables.

* dir.c (rb_push_glob): local variable 'maxnest' was
uninitialized.
Expand Down
4 changes: 2 additions & 2 deletions dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,7 @@ rb_push_glob(str, flags)
char *p, *pend;
char *buf;
char *t;
int nest, maxnest = 0;
int nest, maxnest;
int noescape = flags & FNM_NOESCAPE;
VALUE ary;

Expand All @@ -926,7 +926,7 @@ rb_push_glob(str, flags)

while (p < pend) {
t = buf;
nest = 0;
nest = maxnest = 0;
while (p < pend && isdelim(*p)) p++;
while (p < pend && !isdelim(*p)) {
if (*p == '{') nest++, maxnest++;
Expand Down
19 changes: 10 additions & 9 deletions regex.c
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,16 @@ re_set_syntax(syntax)
((current_mbctype != MBCTYPE_UTF8) ? ((c<0x100) ? (c) : (((c)>>8)&0xff)) : utf8_firstbyte(c))

typedef unsigned int (*mbc_startpos_func_t) _((const char *string, unsigned int pos));
static const mbc_startpos_func_t mbc_startpos_func[];

static unsigned int asc_startpos _((const char *string, unsigned int pos));
static unsigned int euc_startpos _((const char *string, unsigned int pos));
static unsigned int sjis_startpos _((const char *string, unsigned int pos));
static unsigned int utf8_startpos _((const char *string, unsigned int pos));

static const mbc_startpos_func_t mbc_startpos_func[4] = {
asc_startpos, euc_startpos, sjis_startpos, utf8_startpos
};

#define mbc_startpos(start, pos) (*mbc_startpos_func[current_mbctype])((start), (pos))

static unsigned int
Expand Down Expand Up @@ -4499,7 +4508,6 @@ re_mbcinit(mbctype)
#define mbc_isfirst(t, c) (t)[(unsigned char)(c)]
#define mbc_len(t, c) ((t)[(unsigned char)(c)]+1)

static unsigned int asc_startpos _((const char *string, unsigned int pos));
static unsigned int
asc_startpos(string, pos)
const char *string;
Expand All @@ -4510,7 +4518,6 @@ asc_startpos(string, pos)

#define euc_islead(c) ((unsigned char)((c) - 0xa1) > 0xfe - 0xa1)
#define euc_mbclen(c) mbc_len(mbctab_euc, (c))
static unsigned int euc_startpos _((const char *string, unsigned int pos));
static unsigned int
euc_startpos(string, pos)
const char *string;
Expand All @@ -4531,7 +4538,6 @@ euc_startpos(string, pos)
#define sjis_isfirst(c) mbc_isfirst(mbctab_sjis, (c))
#define sjis_istrail(c) mbctab_sjis_trail[(unsigned char)(c)]
#define sjis_mbclen(c) mbc_len(mbctab_sjis, (c))
static unsigned int sjis_startpos _((const char *string, unsigned int pos));
static unsigned int
sjis_startpos(string, pos)
const char *string;
Expand All @@ -4556,7 +4562,6 @@ sjis_startpos(string, pos)

#define utf8_islead(c) ((unsigned char)((c) & 0xc0) != 0x80)
#define utf8_mbclen(c) mbc_len(mbctab_utf8, (c))
static unsigned int utf8_startpos _((const char *string, unsigned int pos));
static unsigned int
utf8_startpos(string, pos)
const char *string;
Expand All @@ -4573,10 +4578,6 @@ utf8_startpos(string, pos)
return i + w;
}

static const mbc_startpos_func_t mbc_startpos_func[4] = {
asc_startpos, euc_startpos, sjis_startpos, utf8_startpos
};

/*
vi: sw=2 ts=8
Local variables:
Expand Down

0 comments on commit 40ceea0

Please sign in to comment.