summaryrefslogtreecommitdiff
path: root/regex.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-09-19 06:54:11 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-09-19 06:54:11 +0000
commit6767cd760a8f5274e238fca4567071a78ac43968 (patch)
tree870d126fba698f90bbb07a7bb67ff3aab4103796 /regex.c
parent67245eec7192abdc1dd0dc2510c1f6c77df89bd0 (diff)
* string.c (rb_str_init): String.new() => ""
* dir.c (dir_path): new method. * dir.c (dir_initialize): wrap DIR into struct, along with path information. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'regex.c')
-rw-r--r--regex.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/regex.c b/regex.c
index 49832ad..f121d48 100644
--- a/regex.c
+++ b/regex.c
@@ -1271,13 +1271,9 @@ re_compile_pattern(pattern, size, bufp)
if (bufp->allocated == 0) {
bufp->allocated = INIT_BUF_SIZE;
- if (bufp->buffer)
- /* EXTEND_BUFFER loses when bufp->allocated is 0. */
- bufp->buffer = (char*)xrealloc(bufp->buffer, INIT_BUF_SIZE);
- else
- /* Caller did not allocate a buffer. Do it for them. */
- bufp->buffer = (char*)xmalloc(INIT_BUF_SIZE);
- if (!bufp->buffer) goto memory_exhausted;
+ /* EXTEND_BUFFER loses when bufp->allocated is 0. */
+ bufp->buffer = (char*)xrealloc(bufp->buffer, INIT_BUF_SIZE);
+ if (!bufp->buffer) goto memory_exhausted; /* this not happen */
begalt = b = bufp->buffer;
}