Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nx-libs
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dimbor
nx-libs
Commits
39dd37d5
Commit
39dd37d5
authored
Jun 04, 2015
by
Alan Coopersmith
Committed by
Ulrich Sibiller
Oct 19, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace Xmalloc+memset pairs with Xcalloc calls
Signed-off-by:
Alan Coopersmith
<
alan.coopersmith@oracle.com
>
Backported-to-NX-by:
Ulrich Sibiller
<
uli42@gmx.de
>
parent
a402ed01
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
19 deletions
+10
-19
XDefaultIMIF.c
nx-X11/lib/X11/XDefaultIMIF.c
+3
-6
imLcIm.c
nx-X11/lib/X11/imLcIm.c
+2
-4
omGeneric.c
nx-X11/lib/X11/omGeneric.c
+5
-9
No files found.
nx-X11/lib/X11/XDefaultIMIF.c
View file @
39dd37d5
...
...
@@ -184,16 +184,14 @@ _XDefaultOpenIM(
return
((
XIM
)
NULL
);
}
if
((
im
=
X
malloc
(
sizeof
(
StaticXIMRec
)))
==
(
StaticXIM
)
NULL
)
{
if
((
im
=
X
calloc
(
1
,
sizeof
(
StaticXIMRec
)))
==
(
StaticXIM
)
NULL
)
{
return
((
XIM
)
NULL
);
}
if
((
local_impart
=
X
malloc
(
sizeof
(
XIMStaticXIMRec
)))
if
((
local_impart
=
X
calloc
(
1
,
sizeof
(
XIMStaticXIMRec
)))
==
(
XIMStaticXIMRec
*
)
NULL
)
{
Xfree
(
im
);
return
((
XIM
)
NULL
);
}
memset
(
im
,
0
,
sizeof
(
StaticXIMRec
));
memset
(
local_impart
,
0
,
sizeof
(
XIMStaticXIMRec
));
buf
[
0
]
=
'\0'
;
i
=
0
;
...
...
@@ -344,10 +342,9 @@ _CreateIC(XIM im, XIMArg *arg)
{
XIC
ic
;
if
((
ic
=
X
malloc
(
sizeof
(
XICRec
)))
==
(
XIC
)
NULL
)
{
if
((
ic
=
X
calloc
(
1
,
sizeof
(
XICRec
)))
==
(
XIC
)
NULL
)
{
return
((
XIC
)
NULL
);
}
memset
(
ic
,
0
,
sizeof
(
XICRec
));
ic
->
methods
=
(
XICMethods
)
&
local_ic_methods
;
ic
->
core
.
im
=
im
;
...
...
nx-X11/lib/X11/imLcIm.c
View file @
39dd37d5
...
...
@@ -447,7 +447,7 @@ _XimWriteCachedDefaultTree(
+
XIM_CACHE_TREE_ALIGNMENT
-
1
)
&
-
XIM_CACHE_TREE_ALIGNMENT
;
DefTreeBase
*
b
=
&
im
->
private
.
local
.
base
;
if
(
!
b
->
tree
&&
!
(
b
->
tree
=
X
malloc
(
sizeof
(
DefTree
)))
)
if
(
!
b
->
tree
&&
!
(
b
->
tree
=
X
calloc
(
1
,
sizeof
(
DefTree
)))
)
return
;
if
(
!
b
->
mb
&&
!
(
b
->
mb
=
Xmalloc
(
1
))
)
return
;
...
...
@@ -457,13 +457,11 @@ _XimWriteCachedDefaultTree(
return
;
/* First entry is always unused */
memset
(
b
->
tree
,
0
,
sizeof
(
DefTree
));
b
->
mb
[
0
]
=
0
;
b
->
wc
[
0
]
=
0
;
b
->
utf8
[
0
]
=
0
;
m
=
Xmalloc
(
msize
);
memset
(
m
,
0
,
msize
);
m
=
Xcalloc
(
1
,
msize
);
m
->
id
=
XIM_CACHE_MAGIC
;
m
->
version
=
XIM_CACHE_VERSION
;
m
->
top
=
im
->
private
.
local
.
top
;
...
...
nx-X11/lib/X11/omGeneric.c
View file @
39dd37d5
...
...
@@ -101,11 +101,10 @@ init_fontdata(
FontData
fd
;
int
i
;
fd
=
X
malloc
(
sizeof
(
FontDataRec
)
*
font_data_count
);
fd
=
X
calloc
(
font_data_count
,
sizeof
(
FontDataRec
)
);
if
(
fd
==
(
FontData
)
NULL
)
return
False
;
memset
(
fd
,
0x00
,
sizeof
(
FontDataRec
)
*
font_data_count
);
for
(
i
=
0
;
i
<
font_data_count
;
i
++
)
fd
[
i
]
=
font_data
[
i
];
...
...
@@ -126,11 +125,10 @@ init_vrotate(
if
(
type
==
VROTATE_NONE
)
return
(
VRotate
)
NULL
;
vrotate
=
X
malloc
(
sizeof
(
VRotateRec
)
*
font_data_count
);
vrotate
=
X
calloc
(
font_data_count
,
sizeof
(
VRotateRec
)
);
if
(
vrotate
==
(
VRotate
)
NULL
)
return
False
;
memset
(
vrotate
,
0x00
,
sizeof
(
VRotateRec
)
*
font_data_count
);
for
(
i
=
0
;
i
<
font_data_count
;
i
++
)
{
vrotate
[
i
].
charset_name
=
font_data
[
i
].
name
;
vrotate
[
i
].
side
=
font_data
[
i
].
side
;
...
...
@@ -155,10 +153,9 @@ init_fontset(
count
=
XOM_GENERIC
(
oc
->
core
.
om
)
->
data_num
;
data
=
XOM_GENERIC
(
oc
->
core
.
om
)
->
data
;
font_set
=
X
malloc
(
sizeof
(
FontSetRec
)
*
count
);
font_set
=
X
calloc
(
count
,
sizeof
(
FontSetRec
)
);
if
(
font_set
==
NULL
)
return
False
;
memset
((
char
*
)
font_set
,
0x00
,
sizeof
(
FontSetRec
)
*
count
);
gen
=
XOC_GENERIC
(
oc
);
gen
->
font_set_num
=
count
;
...
...
@@ -1094,11 +1091,10 @@ parse_vw(
Xfree
(
vrotate
);
if
(
sub_num
>
0
)
{
vrotate
=
font_set
->
vrotate
=
X
malloc
(
sizeof
(
VRotateRec
)
*
sub_num
);
vrotate
=
font_set
->
vrotate
=
X
calloc
(
sub_num
,
sizeof
(
VRotateRec
)
);
if
(
font_set
->
vrotate
==
(
VRotate
)
NULL
)
return
(
-
1
);
memset
(
font_set
->
vrotate
,
0x00
,
sizeof
(
VRotateRec
)
*
sub_num
);
for
(
i
=
0
;
i
<
sub_num
;
i
++
)
{
vrotate
[
i
].
charset_name
=
font_set
->
substitute
[
i
].
name
;
...
...
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