summaryrefslogtreecommitdiff
path: root/xkb/xkbtext.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@sun.com>2009-02-02 19:25:14 -0800
committerAlan Coopersmith <alan.coopersmith@sun.com>2009-02-03 10:06:00 -0800
commit5623c27700b7b23a8dbbd8c8f45e5d4fa0c667e3 (patch)
tree5ef32d8457f859742bcf2aa12019306db49d5c25 /xkb/xkbtext.c
parent6869efae74381e5305b2d6517bf286e3ef7fdcb7 (diff)
Constify atom name strings
Changes MakeAtom to take a const char * and NameForAtom to return them, since many callers pass pointers to constant strings stored in read-only ELF sections. Updates in-tree callers as necessary to clear const mismatch warnings introduced by this change. Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com> Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'xkb/xkbtext.c')
-rw-r--r--xkb/xkbtext.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/xkb/xkbtext.c b/xkb/xkbtext.c
index b9f16a8cc..836d47e28 100644
--- a/xkb/xkbtext.c
+++ b/xkb/xkbtext.c
@@ -70,16 +70,17 @@ char *rtrn;
char *
XkbAtomText(Atom atm,unsigned format)
{
+const char *atmstr;
char *rtrn,*tmp;
- tmp= XkbAtomGetString(atm);
- if (tmp!=NULL) {
+ atmstr = XkbAtomGetString(atm);
+ if (atmstr != NULL) {
int len;
- len= strlen(tmp)+1;
+ len= strlen(atmstr)+1;
if (len>BUFFER_SIZE)
len= BUFFER_SIZE-2;
rtrn= tbGetBuffer(len);
- strncpy(rtrn,tmp,len);
+ strncpy(rtrn,atmstr,len);
rtrn[len]= '\0';
}
else {
@@ -104,7 +105,8 @@ XkbVModIndexText(XkbDescPtr xkb,unsigned ndx,unsigned format)
{
register int len;
register Atom *vmodNames;
-char *rtrn,*tmp;
+char *rtrn;
+const char *tmp;
char numBuf[20];
if (xkb && xkb->names)
@@ -116,8 +118,10 @@ char numBuf[20];
tmp= "illegal";
else if (vmodNames&&(vmodNames[ndx]!=None))
tmp= XkbAtomGetString(vmodNames[ndx]);
- if (tmp==NULL)
- sprintf(tmp=numBuf,"%d",ndx);
+ if (tmp==NULL) {
+ sprintf(numBuf,"%d",ndx);
+ tmp = numBuf;
+ }
len= strlen(tmp)+1;
if (format==XkbCFile)