Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
libX11
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
92
Issues
92
List
Boards
Labels
Service Desk
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xorg
lib
libX11
Commits
ba7f7cc7
Commit
ba7f7cc7
authored
Sep 27, 2015
by
Alan Coopersmith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert src/xlibi18n to use reallocarray()
Signed-off-by:
Alan Coopersmith
<
alan.coopersmith@oracle.com
>
parent
336c1e7a
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
31 additions
and
23 deletions
+31
-23
src/xlibi18n/ICWrap.c
src/xlibi18n/ICWrap.c
+2
-1
src/xlibi18n/XDefaultIMIF.c
src/xlibi18n/XDefaultIMIF.c
+2
-1
src/xlibi18n/XlcDL.c
src/xlibi18n/XlcDL.c
+5
-3
src/xlibi18n/lcDB.c
src/xlibi18n/lcDB.c
+2
-1
src/xlibi18n/lcGeneric.c
src/xlibi18n/lcGeneric.c
+14
-13
src/xlibi18n/lcPrTxt.c
src/xlibi18n/lcPrTxt.c
+4
-3
src/xlibi18n/lcWrap.c
src/xlibi18n/lcWrap.c
+2
-1
No files found.
src/xlibi18n/ICWrap.c
View file @
ba7f7cc7
...
...
@@ -66,6 +66,7 @@ from The Open Group.
#endif
#include "Xlibint.h"
#include "Xlcint.h"
#include "reallocarray.h"
static
int
_XIMNestedListToNestedList
(
...
...
@@ -128,7 +129,7 @@ _XIMVaToNestedList(va_list var, int max_count, XIMArg **args_return)
return
;
}
args
=
Xmalloc
(((
unsigned
)
max_count
+
1
)
*
sizeof
(
XIMArg
));
args
=
Xmalloc
array
((
unsigned
)
max_count
+
1
,
sizeof
(
XIMArg
));
*
args_return
=
args
;
if
(
!
args
)
return
;
...
...
src/xlibi18n/XDefaultIMIF.c
View file @
ba7f7cc7
...
...
@@ -67,6 +67,7 @@ Sun Microsystems, Inc. or its licensors is granted.
#include "Xlibint.h"
#include "Xlcint.h"
#include "XlcGeneric.h"
#include "reallocarray.h"
#ifndef MAXINT
#define MAXINT (~((unsigned int)1 << (8 * sizeof(int)) - 1))
...
...
@@ -266,7 +267,7 @@ _GetIMValues(
*
(
XIMStyles
**
)
p
->
value
=
styles
;
styles
->
count_styles
=
1
;
styles
->
supported_styles
=
Xmalloc
(
styles
->
count_styles
*
sizeof
(
XIMStyle
));
Xmalloc
array
(
styles
->
count_styles
,
sizeof
(
XIMStyle
));
styles
->
supported_styles
[
0
]
=
(
XIMPreeditNone
|
XIMStatusNone
);
}
else
{
break
;
...
...
src/xlibi18n/XlcDL.c
View file @
ba7f7cc7
...
...
@@ -85,6 +85,7 @@ Sun Microsystems, Inc. or its licensors is granted.
#include "Xlibint.h"
#include "XlcPublic.h"
#include "XlcPubI.h"
#include "reallocarray.h"
#define XI18N_DLREL 2
...
...
@@ -185,7 +186,7 @@ resolve_object(char *path, const char *lc_name)
if
(
lc_len
==
0
)
{
/* True only for the 1st time */
lc_len
=
OBJECT_INIT_LEN
;
xi18n_objects_list
=
Xmalloc
(
sizeof
(
XI18NObjectsListRec
)
*
lc_len
);
xi18n_objects_list
=
Xmalloc
array
(
lc_len
,
sizeof
(
XI18NObjectsListRec
)
);
if
(
!
xi18n_objects_list
)
return
;
}
snprintf
(
filename
,
sizeof
(
filename
),
"%s/%s"
,
path
,
"XI18N_OBJS"
);
...
...
@@ -207,8 +208,9 @@ resolve_object(char *path, const char *lc_name)
if
(
lc_count
==
lc_len
)
{
int
new_len
=
lc_len
+
OBJECT_INC_LEN
;
XI18NObjectsListRec
*
tmp
=
Xrealloc
(
xi18n_objects_list
,
sizeof
(
XI18NObjectsListRec
)
*
new_len
);
XI18NObjectsListRec
*
tmp
=
Xreallocarray
(
xi18n_objects_list
,
new_len
,
sizeof
(
XI18NObjectsListRec
));
if
(
tmp
==
NULL
)
goto
done
;
xi18n_objects_list
=
tmp
;
...
...
src/xlibi18n/lcDB.c
View file @
ba7f7cc7
...
...
@@ -39,6 +39,7 @@
#include <X11/Xresource.h>
#include "Xlibint.h"
#include "XlcPubI.h"
#include "reallocarray.h"
#else
/* NOT_X_ENV */
...
...
@@ -492,7 +493,7 @@ append_value_list (void)
char
**
prev_list
=
value_list
;
value_list
=
(
char
**
)
Xrealloc
(
value_list
,
sizeof
(
char
*
)
*
(
value_num
+
2
));
Xrealloc
array
(
value_list
,
value_num
+
2
,
sizeof
(
char
*
));
if
(
value_list
==
NULL
)
{
Xfree
(
prev_list
);
}
...
...
src/xlibi18n/lcGeneric.c
View file @
ba7f7cc7
...
...
@@ -34,6 +34,7 @@
#include <stdio.h>
#include "Xlibint.h"
#include "XlcGeneric.h"
#include "reallocarray.h"
static
XLCd
create
(
const
char
*
name
,
XLCdMethods
methods
);
static
Bool
initialize
(
XLCd
lcd
);
...
...
@@ -157,8 +158,8 @@ add_charset(
int
num
;
if
((
num
=
codeset
->
num_charsets
))
new_list
=
Xrealloc
(
codeset
->
charset_list
,
(
num
+
1
)
*
sizeof
(
XlcCharSet
));
new_list
=
Xrealloc
array
(
codeset
->
charset_list
,
num
+
1
,
sizeof
(
XlcCharSet
));
else
new_list
=
Xmalloc
(
sizeof
(
XlcCharSet
));
...
...
@@ -184,8 +185,8 @@ add_codeset(
return
NULL
;
if
((
num
=
gen
->
codeset_num
))
new_list
=
Xrealloc
(
gen
->
codeset_list
,
(
num
+
1
)
*
sizeof
(
CodeSet
));
new_list
=
Xrealloc
array
(
gen
->
codeset_list
,
num
+
1
,
sizeof
(
CodeSet
));
else
new_list
=
Xmalloc
(
sizeof
(
CodeSet
));
...
...
@@ -231,8 +232,8 @@ add_parse_list(
}
if
((
num
=
gen
->
mb_parse_list_num
))
new_list
=
Xrealloc
(
gen
->
mb_parse_list
,
(
num
+
2
)
*
sizeof
(
ParseInfo
));
new_list
=
Xrealloc
array
(
gen
->
mb_parse_list
,
num
+
2
,
sizeof
(
ParseInfo
));
else
{
new_list
=
Xmalloc
(
2
*
sizeof
(
ParseInfo
));
}
...
...
@@ -350,7 +351,7 @@ _XlcParse_scopemaps(
const
char
*
str_sc
;
num
=
count_scopemap
(
str
);
scope
=
Xmalloc
(
num
*
sizeof
(
FontScopeRec
));
scope
=
Xmalloc
array
(
num
,
sizeof
(
FontScopeRec
));
if
(
scope
==
NULL
)
return
NULL
;
...
...
@@ -535,8 +536,8 @@ add_conversion(
int
num
;
if
((
num
=
gen
->
segment_conv_num
)
>
0
)
{
new_list
=
Xrealloc
(
gen
->
segment_conv
,
(
num
+
1
)
*
sizeof
(
SegConvRec
));
new_list
=
Xrealloc
array
(
gen
->
segment_conv
,
num
+
1
,
sizeof
(
SegConvRec
));
}
else
{
new_list
=
Xmalloc
(
sizeof
(
SegConvRec
));
}
...
...
@@ -667,7 +668,7 @@ create_ctextseg(
ret
->
side
=
XlcGLGR
;
strcpy
(
cset_name
,
ret
->
name
);
}
ret
->
area
=
Xmalloc
((
num
-
1
)
*
sizeof
(
FontScopeRec
));
ret
->
area
=
Xmalloc
array
(
num
-
1
,
sizeof
(
FontScopeRec
));
if
(
ret
->
area
==
NULL
)
{
Xfree
(
cset_name
);
Xfree
(
ret
->
name
);
...
...
@@ -870,8 +871,8 @@ load_generic(
codeset
->
byteM
=
NULL
;
break
;
}
codeset
->
byteM
=
Xmalloc
(
(
codeset
->
length
)
*
sizeof
(
ByteInfoListRec
));
codeset
->
byteM
=
Xmalloc
array
(
codeset
->
length
,
sizeof
(
ByteInfoListRec
));
if
(
codeset
->
byteM
==
NULL
)
{
goto
err
;
}
...
...
@@ -882,7 +883,7 @@ load_generic(
(
codeset
->
byteM
)[
M
-
1
].
M
=
M
;
(
codeset
->
byteM
)[
M
-
1
].
byteinfo_num
=
num
;
(
codeset
->
byteM
)[
M
-
1
].
byteinfo
=
Xmalloc
(
num
*
sizeof
(
ByteInfoRec
));
Xmalloc
array
(
num
,
sizeof
(
ByteInfoRec
));
for
(
ii
=
0
;
ii
<
num
;
ii
++
)
{
tmpb
=
(
codeset
->
byteM
)[
M
-
1
].
byteinfo
;
/* default 0x00 - 0xff */
...
...
src/xlibi18n/lcPrTxt.c
View file @
ba7f7cc7
...
...
@@ -30,6 +30,7 @@
#include "XlcPubI.h"
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include "reallocarray.h"
static
XPointer
*
alloc_list
(
...
...
@@ -40,11 +41,11 @@ alloc_list(
if
(
is_wide_char
)
{
wchar_t
**
wstr_list
;
wstr_list
=
Xmalloc
(
count
*
sizeof
(
wchar_t
*
));
wstr_list
=
Xmalloc
array
(
count
,
sizeof
(
wchar_t
*
));
if
(
wstr_list
==
NULL
)
return
(
XPointer
*
)
NULL
;
*
wstr_list
=
Xmalloc
(
nitems
*
sizeof
(
wchar_t
));
*
wstr_list
=
Xmalloc
array
(
nitems
,
sizeof
(
wchar_t
));
if
(
*
wstr_list
==
NULL
)
{
Xfree
(
wstr_list
);
return
(
XPointer
*
)
NULL
;
...
...
@@ -54,7 +55,7 @@ alloc_list(
}
else
{
char
**
str_list
;
str_list
=
Xmalloc
(
count
*
sizeof
(
char
*
));
str_list
=
Xmalloc
array
(
count
,
sizeof
(
char
*
));
if
(
str_list
==
NULL
)
return
(
XPointer
*
)
NULL
;
...
...
src/xlibi18n/lcWrap.c
View file @
ba7f7cc7
...
...
@@ -66,6 +66,7 @@ from The Open Group.
#endif
#include <X11/Xutil.h>
#include "XlcPubI.h"
#include "reallocarray.h"
#ifdef XTHREADS
LockInfoPtr
_Xi18n_lock
;
...
...
@@ -564,7 +565,7 @@ _XlcVaToArgList(
{
XlcArgList
args
;
*
args_ret
=
args
=
Xmalloc
(
sizeof
(
XlcArg
)
*
count
);
*
args_ret
=
args
=
Xmalloc
array
(
count
,
sizeof
(
XlcArg
)
);
if
(
args
==
(
XlcArgList
)
NULL
)
return
;
...
...
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