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
e15023b2
Commit
e15023b2
authored
Mar 07, 2013
by
Alan Coopersmith
Committed by
Ulrich Sibiller
Oct 19, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove more unnecessary casts from Xmalloc/calloc calls
Signed-off-by:
Alan Coopersmith
<
alan.coopersmith@oracle.com
>
Backported-to-NX-by:
Ulrich Sibiller
<
uli42@gmx.de
>
parent
47d0ea1b
Hide whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
112 additions
and
132 deletions
+112
-132
Context.c
nx-X11/lib/X11/Context.c
+4
-4
CrGC.c
nx-X11/lib/X11/CrGC.c
+1
-1
Depths.c
nx-X11/lib/X11/Depths.c
+1
-1
FSWrap.c
nx-X11/lib/X11/FSWrap.c
+3
-3
Font.c
nx-X11/lib/X11/Font.c
+6
-6
GetAtomNm.c
nx-X11/lib/X11/GetAtomNm.c
+4
-4
GetHints.c
nx-X11/lib/X11/GetHints.c
+4
-5
GetRGBCMap.c
nx-X11/lib/X11/GetRGBCMap.c
+1
-2
ImUtil.c
nx-X11/lib/X11/ImUtil.c
+3
-3
InitExt.c
nx-X11/lib/X11/InitExt.c
+2
-2
IntAtom.c
nx-X11/lib/X11/IntAtom.c
+3
-3
KeyBind.c
nx-X11/lib/X11/KeyBind.c
+3
-5
ModMap.c
nx-X11/lib/X11/ModMap.c
+2
-2
OpenDis.c
nx-X11/lib/X11/OpenDis.c
+3
-5
PixFormats.c
nx-X11/lib/X11/PixFormats.c
+2
-2
PolyReg.c
nx-X11/lib/X11/PolyReg.c
+5
-8
PropAlloc.c
nx-X11/lib/X11/PropAlloc.c
+4
-5
PutBEvent.c
nx-X11/lib/X11/PutBEvent.c
+1
-1
PutImage.c
nx-X11/lib/X11/PutImage.c
+6
-7
Quarks.c
nx-X11/lib/X11/Quarks.c
+4
-5
RdBitF.c
nx-X11/lib/X11/RdBitF.c
+1
-1
Region.c
nx-X11/lib/X11/Region.c
+9
-10
RegstFlt.c
nx-X11/lib/X11/RegstFlt.c
+2
-2
SetFPath.c
nx-X11/lib/X11/SetFPath.c
+1
-1
SetHints.c
nx-X11/lib/X11/SetHints.c
+3
-3
StrToText.c
nx-X11/lib/X11/StrToText.c
+1
-1
TextToStr.c
nx-X11/lib/X11/TextToStr.c
+2
-2
VisUtil.c
nx-X11/lib/X11/VisUtil.c
+3
-5
WrBitF.c
nx-X11/lib/X11/WrBitF.c
+1
-1
XlibInt.c
nx-X11/lib/X11/XlibInt.c
+10
-12
Xrm.c
nx-X11/lib/X11/Xrm.c
+9
-11
locking.c
nx-X11/lib/X11/locking.c
+4
-4
udcInf.c
nx-X11/lib/X11/udcInf.c
+4
-5
No files found.
nx-X11/lib/X11/Context.c
View file @
e15023b2
...
@@ -111,7 +111,7 @@ static void ResizeTable(DB db)
...
@@ -111,7 +111,7 @@ static void ResizeTable(DB db)
otable
=
db
->
table
;
otable
=
db
->
table
;
for
(
i
=
INITHASHMASK
+
1
;
(
i
+
i
)
<
db
->
numentries
;
)
for
(
i
=
INITHASHMASK
+
1
;
(
i
+
i
)
<
db
->
numentries
;
)
i
+=
i
;
i
+=
i
;
db
->
table
=
(
TableEntry
*
)
Xcalloc
((
unsigned
)
i
,
sizeof
(
TableEntry
));
db
->
table
=
Xcalloc
(
i
,
sizeof
(
TableEntry
));
if
(
!
db
->
table
)
{
if
(
!
db
->
table
)
{
db
->
table
=
otable
;
db
->
table
=
otable
;
return
;
return
;
...
@@ -180,11 +180,11 @@ int XSaveContext(
...
@@ -180,11 +180,11 @@ int XSaveContext(
UnlockDisplay
(
display
);
UnlockDisplay
(
display
);
}
}
if
(
!
db
)
{
if
(
!
db
)
{
db
=
(
DB
)
Xmalloc
(
sizeof
(
DBRec
));
db
=
Xmalloc
(
sizeof
(
DBRec
));
if
(
!
db
)
if
(
!
db
)
return
XCNOMEM
;
return
XCNOMEM
;
db
->
mask
=
INITHASHMASK
;
db
->
mask
=
INITHASHMASK
;
db
->
table
=
(
TableEntry
*
)
Xcalloc
(
db
->
mask
+
1
,
sizeof
(
TableEntry
));
db
->
table
=
Xcalloc
(
db
->
mask
+
1
,
sizeof
(
TableEntry
));
if
(
!
db
->
table
)
{
if
(
!
db
->
table
)
{
Xfree
((
char
*
)
db
);
Xfree
((
char
*
)
db
);
return
XCNOMEM
;
return
XCNOMEM
;
...
@@ -210,7 +210,7 @@ int XSaveContext(
...
@@ -210,7 +210,7 @@ int XSaveContext(
return
0
;
return
0
;
}
}
}
}
entry
=
(
TableEntry
)
Xmalloc
(
sizeof
(
TableEntryRec
));
entry
=
Xmalloc
(
sizeof
(
TableEntryRec
));
if
(
!
entry
)
if
(
!
entry
)
return
XCNOMEM
;
return
XCNOMEM
;
entry
->
rid
=
rid
;
entry
->
rid
=
rid
;
...
...
nx-X11/lib/X11/CrGC.c
View file @
e15023b2
...
@@ -72,7 +72,7 @@ GC XCreateGC (
...
@@ -72,7 +72,7 @@ GC XCreateGC (
register
_XExtension
*
ext
;
register
_XExtension
*
ext
;
LockDisplay
(
dpy
);
LockDisplay
(
dpy
);
if
((
gc
=
(
GC
)
Xmalloc
(
sizeof
(
struct
_XGC
)))
==
NULL
)
{
if
((
gc
=
Xmalloc
(
sizeof
(
struct
_XGC
)))
==
NULL
)
{
UnlockDisplay
(
dpy
);
UnlockDisplay
(
dpy
);
SyncHandle
();
SyncHandle
();
return
(
NULL
);
return
(
NULL
);
...
...
nx-X11/lib/X11/Depths.c
View file @
e15023b2
...
@@ -49,7 +49,7 @@ int *XListDepths (
...
@@ -49,7 +49,7 @@ int *XListDepths (
register
Depth
*
dp
;
register
Depth
*
dp
;
register
int
i
;
register
int
i
;
depths
=
(
int
*
)
Xmalloc
(
count
*
sizeof
(
int
));
depths
=
Xmalloc
(
count
*
sizeof
(
int
));
if
(
!
depths
)
return
NULL
;
if
(
!
depths
)
return
NULL
;
for
(
i
=
0
,
dp
=
scr
->
depths
;
i
<
count
;
i
++
,
dp
++
)
for
(
i
=
0
,
dp
=
scr
->
depths
;
i
<
count
;
i
++
,
dp
++
)
depths
[
i
]
=
dp
->
depth
;
depths
[
i
]
=
dp
->
depth
;
...
...
nx-X11/lib/X11/FSWrap.c
View file @
e15023b2
...
@@ -112,7 +112,7 @@ _XParseBaseFontNameList(
...
@@ -112,7 +112,7 @@ _XParseBaseFontNameList(
if
(
!*
ptr
)
if
(
!*
ptr
)
break
;
break
;
}
}
if
(
!
(
list
=
(
char
**
)
Xmalloc
((
unsigned
)
sizeof
(
char
*
)
*
(
*
num
+
1
))))
{
if
(
!
(
list
=
Xmalloc
(
sizeof
(
char
*
)
*
(
*
num
+
1
))))
{
Xfree
(
psave
);
Xfree
(
psave
);
return
(
char
**
)
NULL
;
return
(
char
**
)
NULL
;
}
}
...
@@ -133,7 +133,7 @@ copy_string_list(
...
@@ -133,7 +133,7 @@ copy_string_list(
if
(
string_list
==
NULL
||
list_count
<=
0
)
if
(
string_list
==
NULL
||
list_count
<=
0
)
return
(
char
**
)
NULL
;
return
(
char
**
)
NULL
;
string_list_ret
=
(
char
**
)
Xmalloc
(
sizeof
(
char
*
)
*
list_count
);
string_list_ret
=
Xmalloc
(
sizeof
(
char
*
)
*
list_count
);
if
(
string_list_ret
==
NULL
)
if
(
string_list_ret
==
NULL
)
return
(
char
**
)
NULL
;
return
(
char
**
)
NULL
;
...
@@ -142,7 +142,7 @@ copy_string_list(
...
@@ -142,7 +142,7 @@ copy_string_list(
for
(
length
=
0
;
count
--
>
0
;
list_src
++
)
for
(
length
=
0
;
count
--
>
0
;
list_src
++
)
length
+=
strlen
(
*
list_src
)
+
1
;
length
+=
strlen
(
*
list_src
)
+
1
;
dst
=
(
char
*
)
Xmalloc
(
length
);
dst
=
Xmalloc
(
length
);
if
(
dst
==
NULL
)
{
if
(
dst
==
NULL
)
{
Xfree
(
string_list_ret
);
Xfree
(
string_list_ret
);
return
(
char
**
)
NULL
;
return
(
char
**
)
NULL
;
...
...
nx-X11/lib/X11/Font.c
View file @
e15023b2
...
@@ -215,7 +215,7 @@ _XQueryFont (
...
@@ -215,7 +215,7 @@ _XQueryFont (
DeqAsyncHandler
(
dpy
,
&
async
);
DeqAsyncHandler
(
dpy
,
&
async
);
reply_left
=
reply
.
length
-
reply_left
=
reply
.
length
-
((
SIZEOF
(
xQueryFontReply
)
-
SIZEOF
(
xReply
))
>>
2
);
((
SIZEOF
(
xQueryFontReply
)
-
SIZEOF
(
xReply
))
>>
2
);
if
(
!
(
fs
=
(
XFontStruct
*
)
Xmalloc
(
sizeof
(
XFontStruct
))))
{
if
(
!
(
fs
=
Xmalloc
(
sizeof
(
XFontStruct
))))
{
_XEatDataWords
(
dpy
,
reply_left
);
_XEatDataWords
(
dpy
,
reply_left
);
return
(
XFontStruct
*
)
NULL
;
return
(
XFontStruct
*
)
NULL
;
}
}
...
@@ -324,7 +324,7 @@ _XF86BigfontCodes (
...
@@ -324,7 +324,7 @@ _XF86BigfontCodes (
if
(
pData
)
if
(
pData
)
return
(
XF86BigfontCodes
*
)
pData
->
private_data
;
return
(
XF86BigfontCodes
*
)
pData
->
private_data
;
pData
=
(
XExtData
*
)
Xmalloc
(
sizeof
(
XExtData
)
+
sizeof
(
XF86BigfontCodes
));
pData
=
Xmalloc
(
sizeof
(
XExtData
)
+
sizeof
(
XF86BigfontCodes
));
if
(
!
pData
)
{
if
(
!
pData
)
{
/* Out of luck. */
/* Out of luck. */
return
(
XF86BigfontCodes
*
)
NULL
;
return
(
XF86BigfontCodes
*
)
NULL
;
...
@@ -460,7 +460,7 @@ _XF86BigfontQueryFont (
...
@@ -460,7 +460,7 @@ _XF86BigfontQueryFont (
DeqAsyncHandler
(
dpy
,
&
async1
);
DeqAsyncHandler
(
dpy
,
&
async1
);
reply_left
=
reply
.
length
-
reply_left
=
reply
.
length
-
((
SIZEOF
(
xXF86BigfontQueryFontReply
)
-
SIZEOF
(
xReply
))
>>
2
);
((
SIZEOF
(
xXF86BigfontQueryFontReply
)
-
SIZEOF
(
xReply
))
>>
2
);
if
(
!
(
fs
=
(
XFontStruct
*
)
Xmalloc
(
sizeof
(
XFontStruct
))))
{
if
(
!
(
fs
=
Xmalloc
(
sizeof
(
XFontStruct
))))
{
_XEatDataWords
(
dpy
,
reply_left
);
_XEatDataWords
(
dpy
,
reply_left
);
return
(
XFontStruct
*
)
NULL
;
return
(
XFontStruct
*
)
NULL
;
}
}
...
@@ -523,14 +523,14 @@ _XF86BigfontQueryFont (
...
@@ -523,14 +523,14 @@ _XF86BigfontQueryFont (
nbytes
=
reply
.
nUniqCharInfos
*
SIZEOF
(
xCharInfo
)
nbytes
=
reply
.
nUniqCharInfos
*
SIZEOF
(
xCharInfo
)
+
(
reply
.
nCharInfos
+
1
)
/
2
*
2
*
sizeof
(
CARD16
);
+
(
reply
.
nCharInfos
+
1
)
/
2
*
2
*
sizeof
(
CARD16
);
pUniqCI
=
(
xCharInfo
*
)
Xmalloc
(
nbytes
);
pUniqCI
=
Xmalloc
(
nbytes
);
if
(
!
pUniqCI
)
{
if
(
!
pUniqCI
)
{
if
(
fs
->
properties
)
Xfree
((
char
*
)
fs
->
properties
);
if
(
fs
->
properties
)
Xfree
((
char
*
)
fs
->
properties
);
Xfree
((
char
*
)
fs
);
Xfree
((
char
*
)
fs
);
_XEatDataWords
(
dpy
,
reply_left
);
_XEatDataWords
(
dpy
,
reply_left
);
return
(
XFontStruct
*
)
NULL
;
return
(
XFontStruct
*
)
NULL
;
}
}
if
(
!
(
fs
->
per_char
=
(
XCharStruct
*
)
Xmalloc
(
reply
.
nCharInfos
*
sizeof
(
XCharStruct
))))
{
if
(
!
(
fs
->
per_char
=
Xmalloc
(
reply
.
nCharInfos
*
sizeof
(
XCharStruct
))))
{
Xfree
((
char
*
)
pUniqCI
);
Xfree
((
char
*
)
pUniqCI
);
if
(
fs
->
properties
)
Xfree
((
char
*
)
fs
->
properties
);
if
(
fs
->
properties
)
Xfree
((
char
*
)
fs
->
properties
);
Xfree
((
char
*
)
fs
);
Xfree
((
char
*
)
fs
);
...
@@ -557,7 +557,7 @@ _XF86BigfontQueryFont (
...
@@ -557,7 +557,7 @@ _XF86BigfontQueryFont (
XEDataObject
fs_union
;
XEDataObject
fs_union
;
char
*
addr
;
char
*
addr
;
pData
=
(
XExtData
*
)
Xmalloc
(
sizeof
(
XExtData
));
pData
=
Xmalloc
(
sizeof
(
XExtData
));
if
(
!
pData
)
{
if
(
!
pData
)
{
if
(
fs
->
properties
)
Xfree
((
char
*
)
fs
->
properties
);
if
(
fs
->
properties
)
Xfree
((
char
*
)
fs
->
properties
);
Xfree
((
char
*
)
fs
);
Xfree
((
char
*
)
fs
);
...
...
nx-X11/lib/X11/GetAtomNm.c
View file @
e15023b2
...
@@ -46,7 +46,7 @@ char *_XGetAtomName(
...
@@ -46,7 +46,7 @@ char *_XGetAtomName(
for
(
idx
=
TABLESIZE
;
--
idx
>=
0
;
)
{
for
(
idx
=
TABLESIZE
;
--
idx
>=
0
;
)
{
if
((
e
=
*
table
++
)
&&
(
e
->
atom
==
atom
))
{
if
((
e
=
*
table
++
)
&&
(
e
->
atom
==
atom
))
{
idx
=
strlen
(
EntryName
(
e
))
+
1
;
idx
=
strlen
(
EntryName
(
e
))
+
1
;
if
((
name
=
(
char
*
)
Xmalloc
(
idx
)))
if
((
name
=
Xmalloc
(
idx
)))
strcpy
(
name
,
EntryName
(
e
));
strcpy
(
name
,
EntryName
(
e
));
return
name
;
return
name
;
}
}
...
@@ -73,7 +73,7 @@ char *XGetAtomName(
...
@@ -73,7 +73,7 @@ char *XGetAtomName(
SyncHandle
();
SyncHandle
();
return
(
NULL
);
return
(
NULL
);
}
}
if
((
name
=
(
char
*
)
Xmalloc
(
rep
.
nameLength
+
1
)))
{
if
((
name
=
Xmalloc
(
rep
.
nameLength
+
1
)))
{
_XReadPad
(
dpy
,
name
,
(
long
)
rep
.
nameLength
);
_XReadPad
(
dpy
,
name
,
(
long
)
rep
.
nameLength
);
name
[
rep
.
nameLength
]
=
'\0'
;
name
[
rep
.
nameLength
]
=
'\0'
;
_XUpdateAtomCache
(
dpy
,
name
,
atom
,
0
,
-
1
,
0
);
_XUpdateAtomCache
(
dpy
,
name
,
atom
,
0
,
-
1
,
0
);
...
@@ -124,7 +124,7 @@ Bool _XGetAtomNameHandler(
...
@@ -124,7 +124,7 @@ Bool _XGetAtomNameHandler(
_XGetAsyncReply
(
dpy
,
(
char
*
)
&
replbuf
,
rep
,
buf
,
len
,
_XGetAsyncReply
(
dpy
,
(
char
*
)
&
replbuf
,
rep
,
buf
,
len
,
(
SIZEOF
(
xGetAtomNameReply
)
-
SIZEOF
(
xReply
))
>>
2
,
(
SIZEOF
(
xGetAtomNameReply
)
-
SIZEOF
(
xReply
))
>>
2
,
False
);
False
);
state
->
names
[
state
->
idx
]
=
(
char
*
)
Xmalloc
(
repl
->
nameLength
+
1
);
state
->
names
[
state
->
idx
]
=
Xmalloc
(
repl
->
nameLength
+
1
);
_XGetAsyncData
(
dpy
,
state
->
names
[
state
->
idx
],
buf
,
len
,
_XGetAsyncData
(
dpy
,
state
->
names
[
state
->
idx
],
buf
,
len
,
SIZEOF
(
xGetAtomNameReply
),
repl
->
nameLength
,
SIZEOF
(
xGetAtomNameReply
),
repl
->
nameLength
,
repl
->
length
<<
2
);
repl
->
length
<<
2
);
...
@@ -170,7 +170,7 @@ XGetAtomNames (
...
@@ -170,7 +170,7 @@ XGetAtomNames (
}
}
if
(
missed
>=
0
)
{
if
(
missed
>=
0
)
{
if
(
_XReply
(
dpy
,
(
xReply
*
)
&
rep
,
0
,
xFalse
))
{
if
(
_XReply
(
dpy
,
(
xReply
*
)
&
rep
,
0
,
xFalse
))
{
if
((
names_return
[
missed
]
=
(
char
*
)
Xmalloc
(
rep
.
nameLength
+
1
)))
{
if
((
names_return
[
missed
]
=
Xmalloc
(
rep
.
nameLength
+
1
)))
{
_XReadPad
(
dpy
,
names_return
[
missed
],
(
long
)
rep
.
nameLength
);
_XReadPad
(
dpy
,
names_return
[
missed
],
(
long
)
rep
.
nameLength
);
names_return
[
missed
][
rep
.
nameLength
]
=
'\0'
;
names_return
[
missed
][
rep
.
nameLength
]
=
'\0'
;
_XUpdateAtomCache
(
dpy
,
names_return
[
missed
],
atoms
[
missed
],
_XUpdateAtomCache
(
dpy
,
names_return
[
missed
],
atoms
[
missed
],
...
...
nx-X11/lib/X11/GetHints.c
View file @
e15023b2
...
@@ -128,7 +128,7 @@ XWMHints *XGetWMHints (
...
@@ -128,7 +128,7 @@ XWMHints *XGetWMHints (
return
(
NULL
);
return
(
NULL
);
}
}
/* static copies not allowed in library, due to reentrancy constraint*/
/* static copies not allowed in library, due to reentrancy constraint*/
if
((
hints
=
(
XWMHints
*
)
Xcalloc
(
1
,
(
unsigned
)
sizeof
(
XWMHints
))))
{
if
((
hints
=
Xcalloc
(
1
,
sizeof
(
XWMHints
))))
{
hints
->
flags
=
prop
->
flags
;
hints
->
flags
=
prop
->
flags
;
hints
->
input
=
(
prop
->
input
?
True
:
False
);
hints
->
input
=
(
prop
->
input
?
True
:
False
);
hints
->
initial_state
=
cvtINT32toInt
(
prop
->
initialState
);
hints
->
initial_state
=
cvtINT32toInt
(
prop
->
initialState
);
...
@@ -203,8 +203,7 @@ Status XGetIconSizes (
...
@@ -203,8 +203,7 @@ Status XGetIconSizes (
/* static copies not allowed in library, due to reentrancy constraint*/
/* static copies not allowed in library, due to reentrancy constraint*/
nitems
/=
NumPropIconSizeElements
;
nitems
/=
NumPropIconSizeElements
;
if
(
!
(
hp
=
hints
=
(
XIconSize
*
)
if
(
!
(
hp
=
hints
=
Xcalloc
(
nitems
,
sizeof
(
XIconSize
))))
{
Xcalloc
((
unsigned
)
nitems
,
(
unsigned
)
sizeof
(
XIconSize
))))
{
if
(
prop
)
Xfree
((
char
*
)
prop
);
if
(
prop
)
Xfree
((
char
*
)
prop
);
return
0
;
return
0
;
}
}
...
@@ -317,14 +316,14 @@ XGetClassHint(
...
@@ -317,14 +316,14 @@ XGetClassHint(
if
(
(
actual_type
==
XA_STRING
)
&&
(
actual_format
==
8
)
)
{
if
(
(
actual_type
==
XA_STRING
)
&&
(
actual_format
==
8
)
)
{
len_name
=
strlen
((
char
*
)
data
);
len_name
=
strlen
((
char
*
)
data
);
if
(
!
(
classhint
->
res_name
=
Xmalloc
(
(
unsigned
)
(
len_name
+
1
)
)))
{
if
(
!
(
classhint
->
res_name
=
Xmalloc
(
len_name
+
1
)))
{
Xfree
((
char
*
)
data
);
Xfree
((
char
*
)
data
);
return
(
0
);
return
(
0
);
}
}
strcpy
(
classhint
->
res_name
,
(
char
*
)
data
);
strcpy
(
classhint
->
res_name
,
(
char
*
)
data
);
if
(
len_name
==
nitems
)
len_name
--
;
if
(
len_name
==
nitems
)
len_name
--
;
len_class
=
strlen
((
char
*
)
(
data
+
len_name
+
1
));
len_class
=
strlen
((
char
*
)
(
data
+
len_name
+
1
));
if
(
!
(
classhint
->
res_class
=
Xmalloc
(
(
unsigned
)
(
len_class
+
1
)
)))
{
if
(
!
(
classhint
->
res_class
=
Xmalloc
(
len_class
+
1
)))
{
Xfree
(
classhint
->
res_name
);
Xfree
(
classhint
->
res_name
);
classhint
->
res_name
=
(
char
*
)
NULL
;
classhint
->
res_name
=
(
char
*
)
NULL
;
Xfree
((
char
*
)
data
);
Xfree
((
char
*
)
data
);
...
...
nx-X11/lib/X11/GetRGBCMap.c
View file @
e15023b2
...
@@ -99,8 +99,7 @@ Status XGetRGBColormaps (
...
@@ -99,8 +99,7 @@ Status XGetRGBColormaps (
/*
/*
* allocate array
* allocate array
*/
*/
cmaps
=
(
XStandardColormap
*
)
Xmalloc
(
ncmaps
*
cmaps
=
Xmalloc
(
ncmaps
*
sizeof
(
XStandardColormap
));
sizeof
(
XStandardColormap
));
if
(
!
cmaps
)
{
if
(
!
cmaps
)
{
if
(
data
)
Xfree
((
char
*
)
data
);
if
(
data
)
Xfree
((
char
*
)
data
);
return
False
;
return
False
;
...
...
nx-X11/lib/X11/ImUtil.c
View file @
e15023b2
...
@@ -332,7 +332,7 @@ XImage *XCreateImage (
...
@@ -332,7 +332,7 @@ XImage *XCreateImage (
(
xpad
!=
8
&&
xpad
!=
16
&&
xpad
!=
32
)
||
(
xpad
!=
8
&&
xpad
!=
16
&&
xpad
!=
32
)
||
offset
<
0
)
offset
<
0
)
return
(
XImage
*
)
NULL
;
return
(
XImage
*
)
NULL
;
if
((
image
=
(
XImage
*
)
Xcalloc
(
1
,
(
unsigned
)
sizeof
(
XImage
)))
==
NULL
)
if
((
image
=
Xcalloc
(
1
,
sizeof
(
XImage
)))
==
NULL
)
return
(
XImage
*
)
NULL
;
return
(
XImage
*
)
NULL
;
image
->
width
=
width
;
image
->
width
=
width
;
...
@@ -844,7 +844,7 @@ static XImage *_XSubImage (
...
@@ -844,7 +844,7 @@ static XImage *_XSubImage (
register
unsigned
long
pixel
;
register
unsigned
long
pixel
;
char
*
data
;
char
*
data
;
if
((
subimage
=
(
XImage
*
)
Xcalloc
(
1
,
sizeof
(
XImage
)))
==
NULL
)
if
((
subimage
=
Xcalloc
(
1
,
sizeof
(
XImage
)))
==
NULL
)
return
(
XImage
*
)
NULL
;
return
(
XImage
*
)
NULL
;
subimage
->
width
=
width
;
subimage
->
width
=
width
;
subimage
->
height
=
height
;
subimage
->
height
=
height
;
...
@@ -870,7 +870,7 @@ static XImage *_XSubImage (
...
@@ -870,7 +870,7 @@ static XImage *_XSubImage (
_XInitImageFuncPtrs
(
subimage
);
_XInitImageFuncPtrs
(
subimage
);
dsize
=
subimage
->
bytes_per_line
*
height
;
dsize
=
subimage
->
bytes_per_line
*
height
;
if
(
subimage
->
format
==
XYPixmap
)
dsize
=
dsize
*
subimage
->
depth
;
if
(
subimage
->
format
==
XYPixmap
)
dsize
=
dsize
*
subimage
->
depth
;
if
(((
data
=
Xcalloc
(
1
,
(
unsigned
)
dsize
))
==
NULL
)
&&
(
dsize
>
0
))
{
if
(((
data
=
Xcalloc
(
1
,
dsize
))
==
NULL
)
&&
(
dsize
>
0
))
{
Xfree
((
char
*
)
subimage
);
Xfree
((
char
*
)
subimage
);
return
(
XImage
*
)
NULL
;
return
(
XImage
*
)
NULL
;
}
}
...
...
nx-X11/lib/X11/InitExt.c
View file @
e15023b2
...
@@ -49,7 +49,7 @@ XExtCodes *XInitExtension (
...
@@ -49,7 +49,7 @@ XExtCodes *XInitExtension (
&
codes
.
first_error
))
return
(
NULL
);
&
codes
.
first_error
))
return
(
NULL
);
LockDisplay
(
dpy
);
LockDisplay
(
dpy
);
if
(
!
(
ext
=
(
_XExtension
*
)
Xcalloc
(
1
,
sizeof
(
_XExtension
)))
||
if
(
!
(
ext
=
Xcalloc
(
1
,
sizeof
(
_XExtension
)))
||
!
(
ext
->
name
=
strdup
(
name
)))
{
!
(
ext
->
name
=
strdup
(
name
)))
{
if
(
ext
)
Xfree
((
char
*
)
ext
);
if
(
ext
)
Xfree
((
char
*
)
ext
);
UnlockDisplay
(
dpy
);
UnlockDisplay
(
dpy
);
...
@@ -71,7 +71,7 @@ XExtCodes *XAddExtension (Display *dpy)
...
@@ -71,7 +71,7 @@ XExtCodes *XAddExtension (Display *dpy)
register
_XExtension
*
ext
;
register
_XExtension
*
ext
;
LockDisplay
(
dpy
);
LockDisplay
(
dpy
);
if
(
!
(
ext
=
(
_XExtension
*
)
Xcalloc
(
1
,
sizeof
(
_XExtension
))))
{
if
(
!
(
ext
=
Xcalloc
(
1
,
sizeof
(
_XExtension
))))
{
UnlockDisplay
(
dpy
);
UnlockDisplay
(
dpy
);
return
(
XExtCodes
*
)
NULL
;
return
(
XExtCodes
*
)
NULL
;
}
}
...
...
nx-X11/lib/X11/IntAtom.c
View file @
e15023b2
...
@@ -72,7 +72,7 @@ Atom _XInternAtom(
...
@@ -72,7 +72,7 @@ Atom _XInternAtom(
/* look in the cache first */
/* look in the cache first */
if
(
!
(
atoms
=
dpy
->
atoms
))
{
if
(
!
(
atoms
=
dpy
->
atoms
))
{
dpy
->
atoms
=
atoms
=
(
AtomTable
*
)
Xcalloc
(
1
,
sizeof
(
AtomTable
));
dpy
->
atoms
=
atoms
=
Xcalloc
(
1
,
sizeof
(
AtomTable
));
dpy
->
free_funcs
->
atoms
=
_XFreeAtomTable
;
dpy
->
free_funcs
->
atoms
=
_XFreeAtomTable
;
}
}
sig
=
0
;
sig
=
0
;
...
@@ -127,7 +127,7 @@ _XUpdateAtomCache(
...
@@ -127,7 +127,7 @@ _XUpdateAtomCache(
if
(
!
dpy
->
atoms
)
{
if
(
!
dpy
->
atoms
)
{
if
(
idx
<
0
)
{
if
(
idx
<
0
)
{
dpy
->
atoms
=
(
AtomTable
*
)
Xcalloc
(
1
,
sizeof
(
AtomTable
));
dpy
->
atoms
=
Xcalloc
(
1
,
sizeof
(
AtomTable
));
dpy
->
free_funcs
->
atoms
=
_XFreeAtomTable
;
dpy
->
free_funcs
->
atoms
=
_XFreeAtomTable
;
}
}
if
(
!
dpy
->
atoms
)
if
(
!
dpy
->
atoms
)
...
@@ -147,7 +147,7 @@ _XUpdateAtomCache(
...
@@ -147,7 +147,7 @@ _XUpdateAtomCache(
}
}
}
}
}
}
e
=
(
Entry
)
Xmalloc
(
sizeof
(
EntryRec
)
+
n
+
1
);
e
=
Xmalloc
(
sizeof
(
EntryRec
)
+
n
+
1
);
if
(
e
)
{
if
(
e
)
{
e
->
sig
=
sig
;
e
->
sig
=
sig
;
e
->
atom
=
atom
;
e
->
atom
=
atom
;
...
...
nx-X11/lib/X11/KeyBind.c
View file @
e15023b2
...
@@ -997,11 +997,9 @@ XRebindKeysym (
...
@@ -997,11 +997,9 @@ XRebindKeysym (
tmp
=
dpy
->
key_bindings
;
tmp
=
dpy
->
key_bindings
;
nb
=
sizeof
(
KeySym
)
*
nm
;
nb
=
sizeof
(
KeySym
)
*
nm
;
if
((
!
(
p
=
(
struct
_XKeytrans
*
)
Xcalloc
(
1
,
sizeof
(
struct
_XKeytrans
))))
||
if
((
!
(
p
=
Xcalloc
(
1
,
sizeof
(
struct
_XKeytrans
))))
||
((
!
(
p
->
string
=
(
char
*
)
Xmalloc
(
(
unsigned
)
nbytes
)))
&&
((
!
(
p
->
string
=
Xmalloc
(
nbytes
)))
&&
(
nbytes
>
0
))
||
(
nbytes
>
0
))
||
((
!
(
p
->
modifiers
=
Xmalloc
(
nb
)))
&&
(
nb
>
0
)))
{
((
!
(
p
->
modifiers
=
(
KeySym
*
)
Xmalloc
(
(
unsigned
)
nb
)))
&&
(
nb
>
0
)))
{
if
(
p
)
{
if
(
p
)
{
if
(
p
->
string
)
Xfree
(
p
->
string
);
if
(
p
->
string
)
Xfree
(
p
->
string
);
if
(
p
->
modifiers
)
Xfree
((
char
*
)
p
->
modifiers
);
if
(
p
->
modifiers
)
Xfree
((
char
*
)
p
->
modifiers
);
...
...
nx-X11/lib/X11/ModMap.c
View file @
e15023b2
...
@@ -97,11 +97,11 @@ XSetModifierMapping(
...
@@ -97,11 +97,11 @@ XSetModifierMapping(
XModifierKeymap
*
XModifierKeymap
*
XNewModifiermap
(
int
keyspermodifier
)
XNewModifiermap
(
int
keyspermodifier
)
{
{
XModifierKeymap
*
res
=
(
XModifierKeymap
*
)
Xmalloc
((
sizeof
(
XModifierKeymap
)));
XModifierKeymap
*
res
=
Xmalloc
((
sizeof
(
XModifierKeymap
)));
if
(
res
)
{
if
(
res
)
{
res
->
max_keypermod
=
keyspermodifier
;
res
->
max_keypermod
=
keyspermodifier
;
res
->
modifiermap
=
(
keyspermodifier
>
0
?
res
->
modifiermap
=
(
keyspermodifier
>
0
?
(
KeyCode
*
)
Xmalloc
((
unsigned
)
(
8
*
keyspermodifier
)
)
Xmalloc
(
8
*
keyspermodifier
)
:
(
KeyCode
*
)
NULL
);
:
(
KeyCode
*
)
NULL
);
if
(
keyspermodifier
&&
(
res
->
modifiermap
==
NULL
))
{
if
(
keyspermodifier
&&
(
res
->
modifiermap
==
NULL
))
{
Xfree
((
char
*
)
res
);
Xfree
((
char
*
)
res
);
...
...
nx-X11/lib/X11/OpenDis.c
View file @
e15023b2
...
@@ -182,7 +182,7 @@ XOpenDisplay (
...
@@ -182,7 +182,7 @@ XOpenDisplay (
/*
/*
* Attempt to allocate a display structure. Return NULL if allocation fails.
* Attempt to allocate a display structure. Return NULL if allocation fails.
*/
*/
if
((
dpy
=
(
Display
*
)
Xcalloc
(
1
,
sizeof
(
Display
)))
==
NULL
)
{
if
((
dpy
=
Xcalloc
(
1
,
sizeof
(
Display
)))
==
NULL
)
{
return
(
NULL
);
return
(
NULL
);
}
}
...
@@ -356,9 +356,7 @@ fallback_success:
...
@@ -356,9 +356,7 @@ fallback_success:
dpy
->
qlen
=
0
;
dpy
->
qlen
=
0
;
/* Set up free-function record */
/* Set up free-function record */
if
((
dpy
->
free_funcs
=
(
_XFreeFuncRec
*
)
Xcalloc
(
1
,
if
((
dpy
->
free_funcs
=
Xcalloc
(
1
,
sizeof
(
_XFreeFuncRec
)))
==
NULL
)
{
sizeof
(
_XFreeFuncRec
)))
==
NULL
)
{
OutOfMemory
(
dpy
,
setup
);
OutOfMemory
(
dpy
,
setup
);
return
(
NULL
);
return
(
NULL
);
}
}
...
@@ -523,7 +521,7 @@ fallback_success:
...
@@ -523,7 +521,7 @@ fallback_success:
return
(
NULL
);
return
(
NULL
);
}
}
dpy
->
vendor
=
(
char
*
)
Xmalloc
((
unsigned
)
(
u
.
setup
->
nbytesVendor
+
1
)
);
dpy
->
vendor
=
Xmalloc
(
u
.
setup
->
nbytesVendor
+
1
);
if
(
dpy
->
vendor
==
NULL
)
{
if
(
dpy
->
vendor
==
NULL
)
{
OutOfMemory
(
dpy
,
setup
);
OutOfMemory
(
dpy
,
setup
);
return
(
NULL
);
return
(
NULL
);
...
...
nx-X11/lib/X11/PixFormats.c
View file @
e15023b2
...
@@ -38,8 +38,8 @@ XPixmapFormatValues *XListPixmapFormats (
...
@@ -38,8 +38,8 @@ XPixmapFormatValues *XListPixmapFormats (
Display
*
dpy
,
Display
*
dpy
,
int
*
count
)
/* RETURN */
int
*
count
)
/* RETURN */
{
{
XPixmapFormatValues
*
formats
=
(
XPixmapFormatValues
*
)
XPixmapFormatValues
*
formats
=
Xmalloc
(
(
unsigned
)
(
dpy
->
nformats
*
sizeof
(
XPixmapFormatValues
)
));
Xmalloc
(
dpy
->
nformats
*
sizeof
(
XPixmapFormatValues
));
if
(
formats
)
{
if
(
formats
)
{
register
int
i
;
register
int
i
;
...
...
nx-X11/lib/X11/PolyReg.c
View file @
e15023b2
...
@@ -95,8 +95,7 @@ InsertEdgeInET(
...
@@ -95,8 +95,7 @@ InsertEdgeInET(
{
{
if
(
*
iSLLBlock
>
SLLSPERBLOCK
-
1
)
if
(
*
iSLLBlock
>
SLLSPERBLOCK
-
1
)
{
{
tmpSLLBlock
=
tmpSLLBlock
=
Xmalloc
(
sizeof
(
ScanLineListBlock
));
(
ScanLineListBlock
*
)
Xmalloc
(
sizeof
(
ScanLineListBlock
));
(
*
SLLBlock
)
->
next
=
tmpSLLBlock
;
(
*
SLLBlock
)
->
next
=
tmpSLLBlock
;
tmpSLLBlock
->
next
=
(
ScanLineListBlock
*
)
NULL
;
tmpSLLBlock
->
next
=
(
ScanLineListBlock
*
)
NULL
;
*
SLLBlock
=
tmpSLLBlock
;
*
SLLBlock
=
tmpSLLBlock
;
...
@@ -410,8 +409,7 @@ static int PtsToRegion(
...
@@ -410,8 +409,7 @@ static int PtsToRegion(
numRects
=
((
numFullPtBlocks
*
NUMPTSTOBUFFER
)
+
iCurPtBlock
)
>>
1
;
numRects
=
((
numFullPtBlocks
*
NUMPTSTOBUFFER
)
+
iCurPtBlock
)
>>
1
;
if
(
!
(
reg
->
rects
=
(
BOX
*
)
Xrealloc
((
char
*
)
reg
->
rects
,
if
(
!
(
reg
->
rects
=
Xrealloc
(
reg
->
rects
,
sizeof
(
BOX
)
*
numRects
)))
{
(
unsigned
)
(
sizeof
(
BOX
)
*
numRects
))))
{
Xfree
(
prevRects
);
Xfree
(
prevRects
);
return
(
0
);
return
(
0
);
}
}
...
@@ -521,8 +519,7 @@ XPolygonRegion(
...
@@ -521,8 +519,7 @@ XPolygonRegion(
if
(
Count
<
2
)
return
region
;
if
(
Count
<
2
)
return
region
;
if
(
!
(
pETEs
=
(
EdgeTableEntry
*
)
if
(
!
(
pETEs
=
Xmalloc
(
sizeof
(
EdgeTableEntry
)
*
Count
)))
{
Xmalloc
((
unsigned
)
(
sizeof
(
EdgeTableEntry
)
*
Count
))))
{
XDestroyRegion
(
region
);
XDestroyRegion
(
region
);
return
(
Region
)
NULL
;
return
(
Region
)
NULL
;
}
}
...
@@ -559,7 +556,7 @@ XPolygonRegion(
...
@@ -559,7 +556,7 @@ XPolygonRegion(
* send out the buffer
* send out the buffer
*/
*/
if
(
iPts
==
NUMPTSTOBUFFER
)
{
if
(
iPts
==
NUMPTSTOBUFFER
)
{
tmpPtBlock
=
(
POINTBLOCK
*
)
Xmalloc
(
sizeof
(
POINTBLOCK
));
tmpPtBlock
=
Xmalloc
(
sizeof
(
POINTBLOCK
));
curPtBlock
->
next
=
tmpPtBlock
;
curPtBlock
->
next
=
tmpPtBlock
;
curPtBlock
=
tmpPtBlock
;
curPtBlock
=
tmpPtBlock
;
pts
=
curPtBlock
->
pts
;
pts
=
curPtBlock
->
pts
;
...
@@ -605,7 +602,7 @@ XPolygonRegion(
...
@@ -605,7 +602,7 @@ XPolygonRegion(
* send out the buffer
* send out the buffer
*/
*/
if
(
iPts
==
NUMPTSTOBUFFER
)
{
if
(
iPts
==
NUMPTSTOBUFFER
)
{
tmpPtBlock
=
(
POINTBLOCK
*
)
Xmalloc
(
sizeof
(
POINTBLOCK
));
tmpPtBlock
=
Xmalloc
(
sizeof
(
POINTBLOCK
));
curPtBlock
->
next
=
tmpPtBlock
;
curPtBlock
->
next
=
tmpPtBlock
;
curPtBlock
=
tmpPtBlock
;
curPtBlock
=
tmpPtBlock
;
pts
=
curPtBlock
->
pts
;
pts
=
curPtBlock
->
pts
;
...
...
nx-X11/lib/X11/PropAlloc.c
View file @
e15023b2
...
@@ -39,20 +39,19 @@ in this Software without prior written authorization from The Open Group.
...
@@ -39,20 +39,19 @@ in this Software without prior written authorization from The Open Group.
XSizeHints
*
XAllocSizeHints
(
void
)
XSizeHints
*
XAllocSizeHints
(
void
)
{
{
return
((
XSizeHints
*
)
Xcalloc
(
1
,
(
unsigned
)
sizeof
(
XSizeHints
)
));
return
Xcalloc
(
1
,
sizeof
(
XSizeHints
));
}
}
XStandardColormap
*
XAllocStandardColormap
(
void
)
XStandardColormap
*
XAllocStandardColormap
(
void
)
{
{
return
((
XStandardColormap
*
)
return
Xcalloc
(
1
,
sizeof
(
XStandardColormap
));
Xcalloc
(
1
,
(
unsigned
)
sizeof
(
XStandardColormap
)));
}
}
XWMHints
*
XAllocWMHints
(
void
)
XWMHints
*
XAllocWMHints
(
void
)
{
{
return
((
XWMHints
*
)
Xcalloc
(
1
,
(
unsigned
)
sizeof
(
XWMHints
)
));
return
Xcalloc
(
1
,
sizeof
(
XWMHints
));
}
}
...
@@ -64,7 +63,7 @@ XClassHint *XAllocClassHint (void)
...
@@ -64,7 +63,7 @@ XClassHint *XAllocClassHint (void)
XIconSize
*
XAllocIconSize
(
void
)
XIconSize
*
XAllocIconSize
(
void
)
{
{
return
((
XIconSize
*
)
Xcalloc
(
1
,
(
unsigned
)
sizeof
(
XIconSize
)
));
return
Xcalloc
(
1
,
sizeof
(
XIconSize
));
}
}
nx-X11/lib/X11/PutBEvent.c
View file @
e15023b2
...
@@ -41,7 +41,7 @@ _XPutBackEvent (
...
@@ -41,7 +41,7 @@ _XPutBackEvent (
XEvent
store
=
*
event
;
XEvent
store
=
*
event
;
if
(
!
dpy
->
qfree
)
{
if
(
!
dpy
->
qfree
)
{
if
((
dpy
->
qfree
=
(
_XQEvent
*
)
Xmalloc
(
sizeof
(
_XQEvent
)))
==
NULL
)
{
if
((
dpy
->
qfree
=
Xmalloc
(
sizeof
(
_XQEvent
)))
==
NULL
)
{
return
0
;
return
0
;
}
}
dpy
->
qfree
->
next
=
NULL
;
dpy
->
qfree
->
next
=
NULL
;
...
...
nx-X11/lib/X11/PutImage.c
View file @
e15023b2
...
@@ -680,7 +680,7 @@ SendXYImage(
...
@@ -680,7 +680,7 @@ SendXYImage(
length
=
ROUNDUP
(
length
,
4
);
length
=
ROUNDUP
(
length
,
4
);
if
((
dpy
->
bufptr
+
length
)
>
dpy
->
bufmax
)
{
if
((
dpy
->
bufptr
+
length
)
>
dpy
->
bufmax
)
{
if
((
buf
=
_XAllocScratch
(
dpy
,
(
unsigned
long
)
(
length
)
))
==
NULL
)
{
if
((
buf
=
_XAllocScratch
(
dpy
,
length
))
==
NULL
)
{
UnGetReq
(
PutImage
);
UnGetReq
(
PutImage
);
return
;
return
;
}
}
...
@@ -703,13 +703,13 @@ SendXYImage(
...
@@ -703,13 +703,13 @@ SendXYImage(
bytes_per_temp_plane
=
bytes_per_line
*
req
->
height
;
bytes_per_temp_plane
=
bytes_per_line
*
req
->
height
;
temp_length
=
ROUNDUP
(
bytes_per_temp_plane
*
image
->
depth
,
4
);
temp_length
=
ROUNDUP
(
bytes_per_temp_plane
*
image
->
depth
,
4
);
if
(
buf
==
dpy
->
bufptr
)
{
if
(
buf
==
dpy
->
bufptr
)
{
if
(
!
(
temp
=
_XAllocScratch
(
dpy
,
(
unsigned
long
)
temp_length
)))
{
if
(
!
(
temp
=
_XAllocScratch
(
dpy
,
temp_length
)))
{
UnGetReq
(
PutImage
);
UnGetReq
(
PutImage
);
return
;
return
;
}
}
}
}
else
else
if
((
extra
=
temp
=
Xmalloc
(
(
unsigned
)
temp_length
))
==
NULL
)
{
if
((
extra
=
temp
=
Xmalloc
(
temp_length
))
==
NULL
)
{
UnGetReq
(
PutImage
);
UnGetReq
(
PutImage
);
return
;
return
;
}
}
...
@@ -778,8 +778,7 @@ SendZImage(
...
@@ -778,8 +778,7 @@ SendZImage(
(
req_yoffset
*
image
->
bytes_per_line
)
+
(
req_yoffset
*
image
->
bytes_per_line
)
+
((
req_xoffset
*
image
->
bits_per_pixel
)
>>
3
);
((
req_xoffset
*
image
->
bits_per_pixel
)
>>
3
);
if
((
image
->
bits_per_pixel
==
4
)
&&
((
unsigned
int
)
req_xoffset
&
0x01
))
{
if
((
image
->
bits_per_pixel
==
4
)
&&
((
unsigned
int
)
req_xoffset
&
0x01
))
{
if
(
!
(
shifted_src
=
(
unsigned
char
*
)
if
(
!
(
shifted_src
=
Xmalloc
(
req
->
height
*
image
->
bytes_per_line
)))
{
Xmalloc
((
unsigned
)
(
req
->
height
*
image
->
bytes_per_line
))))
{
UnGetReq
(
PutImage
);
UnGetReq
(
PutImage
);
return
;
return
;
}
}
...
@@ -810,7 +809,7 @@ SendZImage(
...
@@ -810,7 +809,7 @@ SendZImage(
dest
=
(
unsigned
char
*
)
dpy
->
bufptr
;
dest
=
(
unsigned
char
*
)
dpy
->
bufptr
;
else
else
if
((
dest
=
(
unsigned
char
*
)
if
((
dest
=
(
unsigned
char
*
)
_XAllocScratch
(
dpy
,
(
unsigned
long
)(
length
)
))
==
NULL
)
{
_XAllocScratch
(
dpy
,
length
))
==
NULL
)
{
if
(
shifted_src
)
Xfree
((
char
*
)
shifted_src
);
if
(
shifted_src
)
Xfree
((
char
*
)
shifted_src
);
UnGetReq
(
PutImage
);
UnGetReq
(
PutImage
);
return
;
return
;
...
@@ -1001,7 +1000,7 @@ XPutImage (
...
@@ -1001,7 +1000,7 @@ XPutImage (
img
.
bits_per_pixel
=
dest_bits_per_pixel
;
img
.
bits_per_pixel
=
dest_bits_per_pixel
;
img
.
bytes_per_line
=
ROUNDUP
((
dest_bits_per_pixel
*
width
),
img
.
bytes_per_line
=
ROUNDUP
((
dest_bits_per_pixel
*
width
),
dest_scanline_pad
)
>>
3
;
dest_scanline_pad
)
>>
3
;
img
.
data
=
Xmalloc
(
(
unsigned
)
(
img
.
bytes_per_line
*
height
)
);
img
.
data
=
Xmalloc
(
img
.
bytes_per_line
*
height
);
if
(
img
.
data
==
NULL
)
if
(
img
.
data
==
NULL
)
return
0
;
return
0
;
_XInitImageFuncPtrs
(
&
img
);
_XInitImageFuncPtrs
(
&
img
);
...
...
nx-X11/lib/X11/Quarks.c
View file @
e15023b2
...
@@ -186,15 +186,14 @@ ExpandQuarkTable(void)
...
@@ -186,15 +186,14 @@ ExpandQuarkTable(void)
newmask
=
(
oldmask
<<
1
)
+
1
;
newmask
=
(
oldmask
<<
1
)
+
1
;
else
{
else
{
if
(
!
stringTable
)
{
if
(
!
stringTable
)
{
stringTable
=
(
XrmString
**
)
Xmalloc
(
sizeof
(
XrmString
*
)
*
stringTable
=
Xmalloc
(
sizeof
(
XrmString
*
)
*
CHUNKPER
);
CHUNKPER
);
if
(
!
stringTable
)
if
(
!
stringTable
)
return
False
;
return
False
;
stringTable
[
0
]
=
(
XrmString
*
)
NULL
;
stringTable
[
0
]
=
(
XrmString
*
)
NULL
;
}
}
#ifdef PERMQ
#ifdef PERMQ
if
(
!
permTable
)
if
(
!
permTable
)
permTable
=
(
Bits
**
)
Xmalloc
(
sizeof
(
Bits
*
)
*
CHUNKPER
);
permTable
=
Xmalloc
(
sizeof
(
Bits
*
)
*
CHUNKPER
);
if
(
!
permTable
)
if
(
!
permTable
)
return
False
;
return
False
;
#endif
#endif
...
@@ -289,13 +288,13 @@ nomatch: if (!rehash)
...
@@ -289,13 +288,13 @@ nomatch: if (!rehash)
q
=
nextQuark
;
q
=
nextQuark
;
if
(
!
(
q
&
QUANTUMMASK
))
{
if
(
!
(
q
&
QUANTUMMASK
))
{
if
(
!
(
q
&
CHUNKMASK
))
{
if
(
!
(
q
&
CHUNKMASK
))
{
if
(
!
(
new
=
Xrealloc
(
(
char
*
)
stringTable
,
if
(
!
(
new
=
Xrealloc
(
stringTable
,
sizeof
(
XrmString
*
)
*
sizeof
(
XrmString
*
)
*
((
q
>>
QUANTUMSHIFT
)
+
CHUNKPER
))))
((
q
>>
QUANTUMSHIFT
)
+
CHUNKPER
))))
goto
fail
;
goto
fail
;
stringTable
=
(
XrmString
**
)
new
;
stringTable
=
(
XrmString
**
)
new
;
#ifdef PERMQ
#ifdef PERMQ
if
(
!
(
new
=
Xrealloc
(
(
char
*
)
permTable
,
if
(
!
(
new
=
Xrealloc
(
permTable
,
sizeof
(
Bits
*
)
*
sizeof
(
Bits
*
)
*
((
q
>>
QUANTUMSHIFT
)
+
CHUNKPER
))))
((
q
>>
QUANTUMSHIFT
)
+
CHUNKPER
))))
goto
fail
;
goto
fail
;
...
...
nx-X11/lib/X11/RdBitF.c
View file @
e15023b2
...
@@ -191,7 +191,7 @@ XReadBitmapFileData (
...
@@ -191,7 +191,7 @@ XReadBitmapFileData (
bytes_per_line
=
(
ww
+
7
)
/
8
+
padding
;
bytes_per_line
=
(
ww
+
7
)
/
8
+
padding
;
size
=
bytes_per_line
*
hh
;
size
=
bytes_per_line
*
hh
;
bits
=
(
unsigned
char
*
)
Xmalloc
((
unsigned
int
)
size
);
bits
=
Xmalloc
(
size
);
if
(
!
bits
)
if
(
!
bits
)
RETURN
(
BitmapNoMemory
);
RETURN
(
BitmapNoMemory
);
...
...
nx-X11/lib/X11/Region.c
View file @
e15023b2
...
@@ -139,9 +139,9 @@ XCreateRegion(void)
...
@@ -139,9 +139,9 @@ XCreateRegion(void)
{
{
Region
temp
;
Region
temp
;
if
(
!
(
temp
=
(
Region
)
Xmalloc
(
(
unsigned
)
sizeof
(
REGION
))))
if
(
!
(
temp
=
Xmalloc
(
sizeof
(
REGION
))))
return
(
Region
)
NULL
;
return
(
Region
)
NULL
;
if
(
!
(
temp
->
rects
=
(
BOX
*
)
Xmalloc
(
(
unsigned
)
sizeof
(
BOX
))))
{
if
(
!
(
temp
->
rects
=
Xmalloc
(
sizeof
(
BOX
))))
{
Xfree
((
char
*
)
temp
);
Xfree
((
char
*
)
temp
);
return
(
Region
)
NULL
;
return
(
Region
)
NULL
;
}
}
...
@@ -521,9 +521,9 @@ miRegionCopy(
...
@@ -521,9 +521,9 @@ miRegionCopy(
{
{
BOX
*
prevRects
=
dstrgn
->
rects
;
BOX
*
prevRects
=
dstrgn
->
rects
;
if
(
!
(
dstrgn
->
rects
=
(
BOX
*
)
dstrgn
->
rects
=
Xrealloc
(
dstrgn
->
rects
,
Xrealloc
((
char
*
)
dstrgn
->
rects
,
rgn
->
numRects
*
(
sizeof
(
BOX
)));
(
unsigned
)
rgn
->
numRects
*
(
sizeof
(
BOX
))))
)
{
if
(
!
dstrgn
->
rects
)
{
Xfree
(
prevRects
);
Xfree
(
prevRects
);
return
;
return
;
}
}
...
@@ -788,8 +788,7 @@ miRegionOp(
...
@@ -788,8 +788,7 @@ miRegionOp(
*/
*/
newReg
->
size
=
max
(
reg1
->
numRects
,
reg2
->
numRects
)
*
2
;
newReg
->
size
=
max
(
reg1
->
numRects
,
reg2
->
numRects
)
*
2
;
if
(
!
(
newReg
->
rects
=
(
BoxPtr
)
if
(
!
(
newReg
->
rects
=
Xmalloc
(
sizeof
(
BoxRec
)
*
newReg
->
size
)))
{
Xmalloc
((
unsigned
)
(
sizeof
(
BoxRec
)
*
newReg
->
size
))))
{
newReg
->
size
=
0
;
newReg
->
size
=
0
;
return
;
return
;
}
}
...
@@ -980,8 +979,8 @@ miRegionOp(
...
@@ -980,8 +979,8 @@ miRegionOp(
{
{
BoxPtr
prev_rects
=
newReg
->
rects
;
BoxPtr
prev_rects
=
newReg
->
rects
;
newReg
->
size
=
newReg
->
numRects
;
newReg
->
size
=
newReg
->
numRects
;
newReg
->
rects
=
(
BoxPtr
)
Xrealloc
((
char
*
)
newReg
->
rects
,
newReg
->
rects
=
Xrealloc
(
newReg
->
rects
,
(
unsigned
)
(
sizeof
(
BoxRec
)
*
newReg
->
size
)
);
sizeof
(
BoxRec
)
*
newReg
->
size
);
if
(
!
newReg
->
rects
)
if
(
!
newReg
->
rects
)
newReg
->
rects
=
prev_rects
;
newReg
->
rects
=
prev_rects
;
}
}
...
@@ -993,7 +992,7 @@ miRegionOp(
...
@@ -993,7 +992,7 @@ miRegionOp(
*/
*/
newReg
->
size
=
1
;
newReg
->
size
=
1
;
Xfree
((
char
*
)
newReg
->
rects
);
Xfree
((
char
*
)
newReg
->
rects
);
newReg
->
rects
=
(
BoxPtr
)
Xmalloc
(
sizeof
(
BoxRec
));
newReg
->
rects
=
Xmalloc
(
sizeof
(
BoxRec
));
}
}
}
}
Xfree
((
char
*
)
oldRects
);
Xfree
((
char
*
)
oldRects
);
...
...
nx-X11/lib/X11/RegstFlt.c
View file @
e15023b2
...
@@ -85,7 +85,7 @@ _XRegisterFilterByMask(
...
@@ -85,7 +85,7 @@ _XRegisterFilterByMask(
{
{
XFilterEventRec
*
rec
;
XFilterEventRec
*
rec
;
rec
=
(
XFilterEventList
)
Xmalloc
(
sizeof
(
XFilterEventRec
));
rec
=
Xmalloc
(
sizeof
(
XFilterEventRec
));
if
(
!
rec
)
if
(
!
rec
)
return
;
return
;
rec
->
window
=
window
;
rec
->
window
=
window
;
...
@@ -117,7 +117,7 @@ _XRegisterFilterByType(
...
@@ -117,7 +117,7 @@ _XRegisterFilterByType(
{
{
XFilterEventRec
*
rec
;
XFilterEventRec
*
rec
;
rec
=
(
XFilterEventList
)
Xmalloc
(
sizeof
(
XFilterEventRec
));
rec
=
Xmalloc
(
sizeof
(
XFilterEventRec
));
if
(
!
rec
)
if
(
!
rec
)
return
;
return
;
rec
->
window
=
window
;
rec
->
window
=
window
;
...
...
nx-X11/lib/X11/SetFPath.c
View file @
e15023b2
...
@@ -52,7 +52,7 @@ XSetFontPath (
...
@@ -52,7 +52,7 @@ XSetFontPath (
}
}
nbytes
=
(
n
+
3
)
&
~
3
;
nbytes
=
(
n
+
3
)
&
~
3
;
req
->
length
+=
nbytes
>>
2
;
req
->
length
+=
nbytes
>>
2
;
if
((
p
=
(
char
*
)
Xmalloc
((
unsigned
)
nbytes
)))
{
if
((
p
=
Xmalloc
(
nbytes
)))
{
/*
/*
* pack into counted strings.
* pack into counted strings.
*/
*/
...
...
nx-X11/lib/X11/SetHints.c
View file @
e15023b2
...
@@ -184,7 +184,7 @@ XSetIconSizes (
...
@@ -184,7 +184,7 @@ XSetIconSizes (
#define size_of_the_real_thing sizeof
/* avoid grepping screwups */
#define size_of_the_real_thing sizeof
/* avoid grepping screwups */
unsigned
nbytes
=
count
*
size_of_the_real_thing
(
xPropIconSize
);
unsigned
nbytes
=
count
*
size_of_the_real_thing
(
xPropIconSize
);
#undef size_of_the_real_thing
#undef size_of_the_real_thing
if
((
prop
=
pp
=
(
xPropIconSize
*
)
Xmalloc
(
nbytes
)))
{
if
((
prop
=
pp
=
Xmalloc
(
nbytes
)))
{
for
(
i
=
0
;
i
<
count
;
i
++
)
{
for
(
i
=
0
;
i
<
count
;
i
++
)
{
pp
->
minWidth
=
list
->
min_width
;
pp
->
minWidth
=
list
->
min_width
;
pp
->
minHeight
=
list
->
min_height
;
pp
->
minHeight
=
list
->
min_height
;
...
@@ -216,7 +216,7 @@ XSetCommand (
...
@@ -216,7 +216,7 @@ XSetCommand (
for
(
i
=
0
,
nbytes
=
0
;
i
<
argc
;
i
++
)
{
for
(
i
=
0
,
nbytes
=
0
;
i
<
argc
;
i
++
)
{
nbytes
+=
safestrlen
(
argv
[
i
])
+
1
;
nbytes
+=
safestrlen
(
argv
[
i
])
+
1
;
}
}
if
((
bp
=
buf
=
Xmalloc
(
(
unsigned
)
nbytes
)))
{
if
((
bp
=
buf
=
Xmalloc
(
nbytes
)))
{
/* copy arguments into single buffer */
/* copy arguments into single buffer */
for
(
i
=
0
;
i
<
argc
;
i
++
)
{
for
(
i
=
0
;
i
<
argc
;
i
++
)
{
if
(
argv
[
i
])
{
if
(
argv
[
i
])
{
...
@@ -299,7 +299,7 @@ XSetClassHint(
...
@@ -299,7 +299,7 @@ XSetClassHint(
len_nm
=
safestrlen
(
classhint
->
res_name
);
len_nm
=
safestrlen
(
classhint
->
res_name
);
len_cl
=
safestrlen
(
classhint
->
res_class
);
len_cl
=
safestrlen
(
classhint
->
res_class
);
if
((
class_string
=
s
=
Xmalloc
(
(
unsigned
)
(
len_nm
+
len_cl
+
2
)
)))
{
if
((
class_string
=
s
=
Xmalloc
(
len_nm
+
len_cl
+
2
)))
{
if
(
len_nm
)
{
if
(
len_nm
)
{
strcpy
(
s
,
classhint
->
res_name
);
strcpy
(
s
,
classhint
->
res_name
);
s
+=
len_nm
+
1
;
s
+=
len_nm
+
1
;
...
...
nx-X11/lib/X11/StrToText.c
View file @
e15023b2
...
@@ -78,7 +78,7 @@ Status XStringListToTextProperty (
...
@@ -78,7 +78,7 @@ Status XStringListToTextProperty (
}
}
}
}
}
else
{
}
else
{
proto
.
value
=
(
unsigned
char
*
)
Xmalloc
(
1
);
/* easier for client */
proto
.
value
=
Xmalloc
(
1
);
/* easier for client */
if
(
!
proto
.
value
)
return
False
;
if
(
!
proto
.
value
)
return
False
;
proto
.
value
[
0
]
=
'\0'
;
proto
.
value
[
0
]
=
'\0'
;
...
...
nx-X11/lib/X11/TextToStr.c
View file @
e15023b2
...
@@ -72,10 +72,10 @@ Status XTextPropertyToStringList (
...
@@ -72,10 +72,10 @@ Status XTextPropertyToStringList (
/*
/*
* allocate list and duplicate
* allocate list and duplicate
*/
*/
list
=
(
char
**
)
Xmalloc
(
nelements
*
sizeof
(
char
*
));
list
=
Xmalloc
(
nelements
*
sizeof
(
char
*
));
if
(
!
list
)
return
False
;
if
(
!
list
)
return
False
;
start
=
(
char
*
)
Xmalloc
((
datalen
+
1
)
*
sizeof
(
char
));
/* for <NUL> */
start
=
Xmalloc
((
datalen
+
1
)
*
sizeof
(
char
));
/* for <NUL> */
if
(
!
start
)
{
if
(
!
start
)
{
Xfree
((
char
*
)
list
);
Xfree
((
char
*
)
list
);
return
False
;
return
False
;
...
...
nx-X11/lib/X11/VisUtil.c
View file @
e15023b2
...
@@ -75,8 +75,7 @@ XVisualInfo *XGetVisualInfo(
...
@@ -75,8 +75,7 @@ XVisualInfo *XGetVisualInfo(
count
=
0
;
count
=
0
;
total
=
10
;
total
=
10
;
if
(
!
(
vip_base
=
vip
=
(
XVisualInfo
*
)
if
(
!
(
vip_base
=
vip
=
Xmalloc
(
sizeof
(
XVisualInfo
)
*
total
)))
{
Xmalloc
((
unsigned
)
(
sizeof
(
XVisualInfo
)
*
total
))))
{
UnlockDisplay
(
dpy
);
UnlockDisplay
(
dpy
);
return
(
XVisualInfo
*
)
NULL
;
return
(
XVisualInfo
*
)
NULL
;
}
}
...
@@ -132,9 +131,8 @@ XVisualInfo *XGetVisualInfo(
...
@@ -132,9 +131,8 @@ XVisualInfo *XGetVisualInfo(
{
{
XVisualInfo
*
old_vip_base
=
vip_base
;
XVisualInfo
*
old_vip_base
=
vip_base
;
total
+=
10
;
total
+=
10
;
if
(
!
(
vip_base
=
(
XVisualInfo
*
)
if
(
!
(
vip_base
=
Xrealloc
(
vip_base
,
Xrealloc
((
char
*
)
vip_base
,
sizeof
(
XVisualInfo
)
*
total
)))
{
(
unsigned
)
(
sizeof
(
XVisualInfo
)
*
total
))))
{
Xfree
((
char
*
)
old_vip_base
);
Xfree
((
char
*
)
old_vip_base
);
UnlockDisplay
(
dpy
);
UnlockDisplay
(
dpy
);
return
(
XVisualInfo
*
)
NULL
;
return
(
XVisualInfo
*
)
NULL
;
...
...
nx-X11/lib/X11/WrBitF.c
View file @
e15023b2
...
@@ -53,7 +53,7 @@ static char *Format_Image(
...
@@ -53,7 +53,7 @@ static char *Format_Image(
bytes_per_line
=
(
width
+
7
)
/
8
;
bytes_per_line
=
(
width
+
7
)
/
8
;
*
resultsize
=
bytes_per_line
*
height
;
/* Calculate size of data */
*
resultsize
=
bytes_per_line
*
height
;
/* Calculate size of data */
data
=
(
char
*
)
Xmalloc
(
*
resultsize
);
/* Get space for data */
data
=
Xmalloc
(
*
resultsize
);
/* Get space for data */
if
(
!
data
)
if
(
!
data
)
return
(
ERR_RETURN
);
return
(
ERR_RETURN
);
...
...
nx-X11/lib/X11/XlibInt.c
View file @
e15023b2
...
@@ -608,7 +608,7 @@ Bool _XPollfdCacheInit(
...
@@ -608,7 +608,7 @@ Bool _XPollfdCacheInit(
#ifdef USE_POLL
#ifdef USE_POLL
struct
pollfd
*
pfp
;
struct
pollfd
*
pfp
;
pfp
=
(
struct
pollfd
*
)
Xmalloc
(
POLLFD_CACHE_SIZE
*
sizeof
(
struct
pollfd
));
pfp
=
Xmalloc
(
POLLFD_CACHE_SIZE
*
sizeof
(
struct
pollfd
));
if
(
!
pfp
)
if
(
!
pfp
)
return
False
;
return
False
;
pfp
[
0
].
fd
=
dpy
->
fd
;
pfp
[
0
].
fd
=
dpy
->
fd
;
...
@@ -2477,10 +2477,10 @@ _XRegisterInternalConnection(
...
@@ -2477,10 +2477,10 @@ _XRegisterInternalConnection(
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG)
#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG)
fprintf
(
stderr
,
"_XRegisterInternalConnection: Got called.
\n
"
);
fprintf
(
stderr
,
"_XRegisterInternalConnection: Got called.
\n
"
);
#endif
#endif
new_conni
=
(
struct
_XConnectionInfo
*
)
Xmalloc
(
sizeof
(
struct
_XConnectionInfo
));
new_conni
=
Xmalloc
(
sizeof
(
struct
_XConnectionInfo
));
if
(
!
new_conni
)
if
(
!
new_conni
)
return
0
;
return
0
;
new_conni
->
watch_data
=
(
XPointer
*
)
Xmalloc
(
dpy
->
watcher_count
*
sizeof
(
XPointer
));
new_conni
->
watch_data
=
Xmalloc
(
dpy
->
watcher_count
*
sizeof
(
XPointer
));
if
(
!
new_conni
->
watch_data
)
{
if
(
!
new_conni
->
watch_data
)
{
Xfree
(
new_conni
);
Xfree
(
new_conni
);
return
0
;
return
0
;
...
@@ -2573,7 +2573,7 @@ XInternalConnectionNumbers(
...
@@ -2573,7 +2573,7 @@ XInternalConnectionNumbers(
count
=
0
;
count
=
0
;
for
(
info_list
=
dpy
->
im_fd_info
;
info_list
;
info_list
=
info_list
->
next
)
for
(
info_list
=
dpy
->
im_fd_info
;
info_list
;
info_list
=
info_list
->
next
)
count
++
;
count
++
;
fd_list
=
(
int
*
)
Xmalloc
(
count
*
sizeof
(
int
));
fd_list
=
Xmalloc
(
count
*
sizeof
(
int
));
if
(
!
fd_list
)
{
if
(
!
fd_list
)
{
UnlockDisplay
(
dpy
);
UnlockDisplay
(
dpy
);
return
0
;
return
0
;
...
@@ -2666,9 +2666,8 @@ XAddConnectionWatch(
...
@@ -2666,9 +2666,8 @@ XAddConnectionWatch(
/* allocate new watch data */
/* allocate new watch data */
for
(
info_list
=
dpy
->
im_fd_info
;
info_list
;
info_list
=
info_list
->
next
)
{
for
(
info_list
=
dpy
->
im_fd_info
;
info_list
;
info_list
=
info_list
->
next
)
{
wd_array
=
(
XPointer
*
)
Xrealloc
((
char
*
)
info_list
->
watch_data
,
wd_array
=
Xrealloc
(
info_list
->
watch_data
,
(
dpy
->
watcher_count
+
1
)
*
(
dpy
->
watcher_count
+
1
)
*
sizeof
(
XPointer
));
sizeof
(
XPointer
));
if
(
!
wd_array
)
{
if
(
!
wd_array
)
{
UnlockDisplay
(
dpy
);
UnlockDisplay
(
dpy
);
return
0
;
return
0
;
...
@@ -2677,7 +2676,7 @@ XAddConnectionWatch(
...
@@ -2677,7 +2676,7 @@ XAddConnectionWatch(
wd_array
[
dpy
->
watcher_count
]
=
NULL
;
/* for cleanliness */
wd_array
[
dpy
->
watcher_count
]
=
NULL
;
/* for cleanliness */
}
}
new_watcher
=
(
struct
_XConnWatchInfo
*
)
Xmalloc
(
sizeof
(
struct
_XConnWatchInfo
));
new_watcher
=
Xmalloc
(
sizeof
(
struct
_XConnWatchInfo
));
if
(
!
new_watcher
)
{
if
(
!
new_watcher
)
{
UnlockDisplay
(
dpy
);
UnlockDisplay
(
dpy
);
return
0
;
return
0
;
...
@@ -2936,8 +2935,7 @@ void _XEnq(
...
@@ -2936,8 +2935,7 @@ void _XEnq(
/* If dpy->qfree is non-NULL do this, else malloc a new one. */
/* If dpy->qfree is non-NULL do this, else malloc a new one. */
dpy
->
qfree
=
qelt
->
next
;
dpy
->
qfree
=
qelt
->
next
;
}
}
else
if
((
qelt
=
else
if
((
qelt
=
Xmalloc
(
sizeof
(
_XQEvent
)))
==
NULL
)
{
(
_XQEvent
*
)
Xmalloc
((
unsigned
)
sizeof
(
_XQEvent
)))
==
NULL
)
{
/* Malloc call failed! */
/* Malloc call failed! */
ESET
(
ENOMEM
);
ESET
(
ENOMEM
);
#ifdef NX_TRANS_SOCKET
#ifdef NX_TRANS_SOCKET
...
@@ -3766,8 +3764,8 @@ char *_XAllocScratch(
...
@@ -3766,8 +3764,8 @@ char *_XAllocScratch(
{
{
if
(
nbytes
>
dpy
->
scratch_length
)
{
if
(
nbytes
>
dpy
->
scratch_length
)
{
if
(
dpy
->
scratch_buffer
)
Xfree
(
dpy
->
scratch_buffer
);
if
(
dpy
->
scratch_buffer
)
Xfree
(
dpy
->
scratch_buffer
);
if
((
dpy
->
scratch_buffer
=
Xmalloc
((
unsigned
)
nbytes
)))
if
((
dpy
->
scratch_buffer
=
Xmalloc
(
nbytes
)))
dpy
->
scratch_length
=
nbytes
;
dpy
->
scratch_length
=
nbytes
;
else
dpy
->
scratch_length
=
0
;
else
dpy
->
scratch_length
=
0
;
}
}
return
(
dpy
->
scratch_buffer
);
return
(
dpy
->
scratch_buffer
);
...
...
nx-X11/lib/X11/Xrm.c
View file @
e15023b2
...
@@ -494,7 +494,7 @@ static XrmDatabase NewDatabase(void)
...
@@ -494,7 +494,7 @@ static XrmDatabase NewDatabase(void)
{
{
register
XrmDatabase
db
;
register
XrmDatabase
db
;
db
=
(
XrmDatabase
)
Xmalloc
(
sizeof
(
XrmHashBucketRec
));
db
=
Xmalloc
(
sizeof
(
XrmHashBucketRec
));
if
(
db
)
{
if
(
db
)
{
_XCreateMutex
(
&
db
->
linfo
);
_XCreateMutex
(
&
db
->
linfo
);
db
->
table
=
(
NTable
)
NULL
;
db
->
table
=
(
NTable
)
NULL
;
...
@@ -827,7 +827,7 @@ static void PutEntry(
...
@@ -827,7 +827,7 @@ static void PutEntry(
NTable
*
nprev
,
*
firstpprev
;
NTable
*
nprev
,
*
firstpprev
;
#define NEWTABLE(q,i) \
#define NEWTABLE(q,i) \
table =
(NTable)
Xmalloc(sizeof(LTableRec)); \
table = Xmalloc(sizeof(LTableRec)); \
if (!table) \
if (!table) \
return; \
return; \
table->name = q; \
table->name = q; \
...
@@ -840,7 +840,7 @@ static void PutEntry(
...
@@ -840,7 +840,7 @@ static void PutEntry(
nprev = NodeBuckets(table); \
nprev = NodeBuckets(table); \
} else { \
} else { \
table->leaf = 1; \
table->leaf = 1; \
if (!(nprev =
(NTable *)
Xmalloc(sizeof(VEntry *)))) {\
if (!(nprev = Xmalloc(sizeof(VEntry *)))) {\
Xfree(table); \
Xfree(table); \
return; \
return; \
} \
} \
...
@@ -954,9 +954,8 @@ static void PutEntry(
...
@@ -954,9 +954,8 @@ static void PutEntry(
prev
=
nprev
;
prev
=
nprev
;
}
}
/* now allocate the value entry */
/* now allocate the value entry */
entry
=
(
VEntry
)
Xmalloc
(((
type
==
XrmQString
)
?
entry
=
Xmalloc
(((
type
==
XrmQString
)
?
sizeof
(
VEntryRec
)
:
sizeof
(
DEntryRec
))
+
sizeof
(
VEntryRec
)
:
sizeof
(
DEntryRec
))
+
value
->
size
);
value
->
size
);
if
(
!
entry
)
if
(
!
entry
)
return
;
return
;
entry
->
name
=
q
=
*
quarks
;
entry
->
name
=
q
=
*
quarks
;
...
@@ -986,13 +985,12 @@ static void PutEntry(
...
@@ -986,13 +985,12 @@ static void PutEntry(
if
(
resourceQuarks
)
{
if
(
resourceQuarks
)
{
unsigned
char
*
prevQuarks
=
resourceQuarks
;
unsigned
char
*
prevQuarks
=
resourceQuarks
;
resourceQuarks
=
(
unsigned
char
*
)
Xrealloc
((
char
*
)
resourceQuarks
,
resourceQuarks
=
Xrealloc
(
resourceQuarks
,
size
);
size
);
if
(
!
resourceQuarks
)
{
if
(
!
resourceQuarks
)
{
Xfree
(
prevQuarks
);
Xfree
(
prevQuarks
);
}
}
}
else
}
else
resourceQuarks
=
(
unsigned
char
*
)
Xmalloc
(
size
);
resourceQuarks
=
Xmalloc
(
size
);
if
(
resourceQuarks
)
{
if
(
resourceQuarks
)
{
bzero
((
char
*
)
&
resourceQuarks
[
oldsize
],
size
-
oldsize
);
bzero
((
char
*
)
&
resourceQuarks
[
oldsize
],
size
-
oldsize
);
maxResourceQuark
=
(
size
<<
3
)
-
1
;
maxResourceQuark
=
(
size
<<
3
)
-
1
;
...
@@ -1137,11 +1135,11 @@ static void GetDatabase(
...
@@ -1137,11 +1135,11 @@ static void GetDatabase(
str_len
=
strlen
(
str
);
str_len
=
strlen
(
str
);
if
(
DEF_BUFF_SIZE
>
str_len
)
lhs
=
lhs_s
;
if
(
DEF_BUFF_SIZE
>
str_len
)
lhs
=
lhs_s
;
else
if
((
lhs
=
(
char
*
)
Xmalloc
(
str_len
))
==
NULL
)
else
if
((
lhs
=
Xmalloc
(
str_len
))
==
NULL
)
return
;
return
;
alloc_chars
=
DEF_BUFF_SIZE
<
str_len
?
str_len
:
DEF_BUFF_SIZE
;
alloc_chars
=
DEF_BUFF_SIZE
<
str_len
?
str_len
:
DEF_BUFF_SIZE
;
if
((
rhs
=
(
char
*
)
Xmalloc
(
alloc_chars
))
==
NULL
)
{
if
((
rhs
=
Xmalloc
(
alloc_chars
))
==
NULL
)
{
if
(
lhs
!=
lhs_s
)
Xfree
(
lhs
);
if
(
lhs
!=
lhs_s
)
Xfree
(
lhs
);
return
;
return
;
}
}
...
...
nx-X11/lib/X11/locking.c
View file @
e15023b2
...
@@ -82,7 +82,7 @@ _Xthread_waiter(void)
...
@@ -82,7 +82,7 @@ _Xthread_waiter(void)
struct
_xthread_waiter
*
me
;
struct
_xthread_waiter
*
me
;
if
(
!
(
me
=
TlsGetValue
(
_X_TlsIndex
)))
{
if
(
!
(
me
=
TlsGetValue
(
_X_TlsIndex
)))
{
me
=
(
struct
_xthread_waiter
*
)
xmalloc
(
sizeof
(
struct
_xthread_waiter
));
me
=
xmalloc
(
sizeof
(
struct
_xthread_waiter
));
me
->
sem
=
CreateSemaphore
(
NULL
,
0
,
1
,
NULL
);
me
->
sem
=
CreateSemaphore
(
NULL
,
0
,
1
,
NULL
);
me
->
next
=
NULL
;
me
->
next
=
NULL
;
TlsSetValue
(
_X_TlsIndex
,
me
);
TlsSetValue
(
_X_TlsIndex
,
me
);
...
@@ -249,7 +249,7 @@ static struct _XCVList *_XCreateCVL(
...
@@ -249,7 +249,7 @@ static struct _XCVList *_XCreateCVL(
dpy
->
lock
->
free_cvls
=
cvl
->
next
;
dpy
->
lock
->
free_cvls
=
cvl
->
next
;
dpy
->
lock
->
num_free_cvls
--
;
dpy
->
lock
->
num_free_cvls
--
;
}
else
{
}
else
{
cvl
=
(
struct
_XCVList
*
)
Xmalloc
(
sizeof
(
struct
_XCVList
));
cvl
=
Xmalloc
(
sizeof
(
struct
_XCVList
));
if
(
!
cvl
)
if
(
!
cvl
)
return
NULL
;
return
NULL
;
cvl
->
cv
=
xcondition_malloc
();
cvl
->
cv
=
xcondition_malloc
();
...
@@ -512,10 +512,10 @@ void _XUserUnlockDisplay(
...
@@ -512,10 +512,10 @@ void _XUserUnlockDisplay(
static
int
_XInitDisplayLock
(
static
int
_XInitDisplayLock
(
Display
*
dpy
)
Display
*
dpy
)
{
{
dpy
->
lock_fns
=
(
struct
_XLockPtrs
*
)
Xmalloc
(
sizeof
(
struct
_XLockPtrs
));
dpy
->
lock_fns
=
Xmalloc
(
sizeof
(
struct
_XLockPtrs
));
if
(
dpy
->
lock_fns
==
NULL
)
if
(
dpy
->
lock_fns
==
NULL
)
return
-
1
;
return
-
1
;
dpy
->
lock
=
(
struct
_XLockInfo
*
)
Xmalloc
(
sizeof
(
struct
_XLockInfo
));
dpy
->
lock
=
Xmalloc
(
sizeof
(
struct
_XLockInfo
));
if
(
dpy
->
lock
==
NULL
)
{
if
(
dpy
->
lock
==
NULL
)
{
_XFreeDisplayLock
(
dpy
);
_XFreeDisplayLock
(
dpy
);
return
-
1
;
return
-
1
;
...
...
nx-X11/lib/X11/udcInf.c
View file @
e15023b2
...
@@ -145,12 +145,11 @@ int *num_codeset;
...
@@ -145,12 +145,11 @@ int *num_codeset;
if
(
!
_XlcCompareISOLatin1
(
charset_str
,
buf
)){
if
(
!
_XlcCompareISOLatin1
(
charset_str
,
buf
)){
num_ret
+=
1
;
num_ret
+=
1
;
if
(
num_ret
==
1
){
if
(
num_ret
==
1
){
ret
=
(
int
*
)
Xmalloc
(
sizeof
(
int
));
ret
=
Xmalloc
(
sizeof
(
int
));
}
else
{
}
else
{
int
*
prev_ret
=
ret
;
int
*
prev_ret
=
ret
;
ret
=
ret
=
Xrealloc
(
ret
,
num_ret
*
sizeof
(
int
));
(
int
*
)
Xrealloc
(
ret
,
num_ret
*
sizeof
(
int
));
if
(
ret
==
NULL
){
if
(
ret
==
NULL
){
Xfree
(
prev_ret
);
Xfree
(
prev_ret
);
}
}
...
@@ -272,7 +271,7 @@ int *num_gr;
...
@@ -272,7 +271,7 @@ int *num_gr;
sprintf
(
buf
,
"fs%d.charset.udc_area"
,
codeset
-
1
);
sprintf
(
buf
,
"fs%d.charset.udc_area"
,
codeset
-
1
);
_XlcGetLocaleDataBase
(
lcd
,
"XLC_FONTSET"
,
buf
,
&
value
,
&
count
);
_XlcGetLocaleDataBase
(
lcd
,
"XLC_FONTSET"
,
buf
,
&
value
,
&
count
);
if
(
count
>
0
){
if
(
count
>
0
){
udc
=
(
_XUDCGlyphRegion
*
)
Xmalloc
(
count
*
sizeof
(
_XUDCGlyphRegion
));
udc
=
Xmalloc
(
count
*
sizeof
(
_XUDCGlyphRegion
));
if
(
udc
==
NULL
){
if
(
udc
==
NULL
){
_xudc_utyerrno
=
0x03
;
_xudc_utyerrno
=
0x03
;
_xudc_utyerrno
|=
(
0x0b
<<
8
)
;
_xudc_utyerrno
|=
(
0x0b
<<
8
)
;
...
@@ -524,7 +523,7 @@ int *num_cr;
...
@@ -524,7 +523,7 @@ int *num_cr;
return
(
ret
);
return
(
ret
);
}
}
crr
=
(
_XUDCCodeRegion
*
)
Xmalloc
(
num_gr
*
sizeof
(
_XUDCCodeRegion
));
crr
=
Xmalloc
(
num_gr
*
sizeof
(
_XUDCCodeRegion
));
if
(
crr
==
NULL
){
if
(
crr
==
NULL
){
Xfree
(
gr
);
Xfree
(
gr
);
_xudc_utyerrno
=
0x03
;
_xudc_utyerrno
=
0x03
;
...
...
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