Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
56c66747
Commit
56c66747
authored
Apr 06, 1995
by
Per Bothner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* cppalloc.c (xcalloc): Re-implement using calloc, rather than malloc+bzero.
From-SVN: r9319
parent
746a9efa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
26 deletions
+7
-26
gcc/cppalloc.c
+7
-26
No files found.
gcc/cppalloc.c
View file @
56c66747
...
@@ -45,10 +45,9 @@ xrealloc (old, size)
...
@@ -45,10 +45,9 @@ xrealloc (old, size)
unsigned
size
;
unsigned
size
;
{
{
register
char
*
ptr
=
(
char
*
)
realloc
(
old
,
size
);
register
char
*
ptr
=
(
char
*
)
realloc
(
old
,
size
);
if
(
ptr
!=
0
)
return
(
ptr
);
if
(
ptr
==
0
)
memory_full
();
memory_full
();
/*NOTREACHED*/
return
ptr
;
return
0
;
}
}
char
*
char
*
...
@@ -56,26 +55,8 @@ xcalloc (number, size)
...
@@ -56,26 +55,8 @@ xcalloc (number, size)
unsigned
number
,
size
;
unsigned
number
,
size
;
{
{
register
unsigned
total
=
number
*
size
;
register
unsigned
total
=
number
*
size
;
register
char
*
ptr
=
(
char
*
)
malloc
(
total
);
register
char
*
ptr
=
(
char
*
)
calloc
(
number
,
size
);
if
(
ptr
!=
0
)
{
if
(
ptr
==
0
)
if
(
total
>
100
)
memory_full
();
bzero
(
ptr
,
total
);
return
ptr
;
else
{
/* It's not too long, so loop, zeroing by longs.
It must be safe because malloc values are always well aligned. */
register
long
*
zp
=
(
long
*
)
ptr
;
register
long
*
zl
=
(
long
*
)
(
ptr
+
total
-
4
);
register
int
i
=
total
-
4
;
while
(
zp
<
zl
)
*
zp
++
=
0
;
if
(
i
<
0
)
i
=
0
;
while
(
i
<
total
)
ptr
[
i
++
]
=
0
;
}
return
ptr
;
}
memory_full
();
/*NOTREACHED*/
return
0
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment