diff options
Diffstat (limited to 'libX11/src/xlibi18n/lcDB.c')
-rw-r--r-- | libX11/src/xlibi18n/lcDB.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/libX11/src/xlibi18n/lcDB.c b/libX11/src/xlibi18n/lcDB.c index 97b22ac44..fda3ae7e3 100644 --- a/libX11/src/xlibi18n/lcDB.c +++ b/libX11/src/xlibi18n/lcDB.c @@ -165,7 +165,7 @@ init_parse_info (void) int size; if (!allocated) { bzero(&parse_info, sizeof(DBParseInfo)); - parse_info.buf = (char *)Xmalloc(BUFSIZE); + parse_info.buf = Xmalloc(BUFSIZE); parse_info.bufMaxSize = BUFSIZE; allocated = 1; return; @@ -196,7 +196,7 @@ clear_parse_info (void) if (*parse_info.value) { Xfree(*parse_info.value); } - Xfree((char *)parse_info.value); + Xfree(parse_info.value); } ptr = parse_info.buf; size = parse_info.bufMaxSize; @@ -210,11 +210,12 @@ realloc_parse_info( int len) { char *p; + int newsize = BUFSIZE * ((parse_info.bufsize + len)/BUFSIZE + 1); - parse_info.bufMaxSize = BUFSIZE * ((parse_info.bufsize + len)/BUFSIZE + 1); - p = (char *)Xrealloc(parse_info.buf, parse_info.bufMaxSize); + p = Xrealloc(parse_info.buf, newsize); if (p == NULL) return False; + parse_info.bufMaxSize = newsize; parse_info.buf = p; return True; @@ -247,9 +248,9 @@ realloc_line( char *str = line->str; if (str != NULL) { - str = (char *)Xrealloc(str, size); + str = Xrealloc(str, size); } else { - str = (char *)Xmalloc(size); + str = Xmalloc(size); } if (str == NULL) { /* malloc error */ @@ -485,7 +486,7 @@ append_value_list (void) } if (value_list == (char **)NULL) { - value_list = (char **)Xmalloc(sizeof(char *) * 2); + value_list = Xmalloc(sizeof(char *) * 2); *value_list = NULL; } else { char **prev_list = value_list; @@ -501,11 +502,11 @@ append_value_list (void) value = *value_list; if (value == NULL) { - value = (char *)Xmalloc(value_len + len + 1); + value = Xmalloc(value_len + len + 1); } else { char *prev_value = value; - value = (char *)Xrealloc(value, value_len + len + 1); + value = Xrealloc(value, value_len + len + 1); if (value == NULL) { Xfree(prev_value); } @@ -1032,10 +1033,10 @@ DestroyDatabase( if (*p->value != NULL) { Xfree(*p->value); } - Xfree((char *)p->value); + Xfree(p->value); } db = p->next; - Xfree((char *)p); + Xfree(p); p = db; } } @@ -1248,7 +1249,7 @@ _XlcDestroyLocaleDataBase( if (p->lc_db == lc_db) { if ((-- p->ref_count) < 1) { if (p->lc_db != (XlcDatabase)NULL) { - Xfree((char *)p->lc_db); + Xfree(p->lc_db); } DestroyDatabase(p->database); if (prev == (XlcDatabaseList)NULL) { @@ -1313,7 +1314,7 @@ _XlcCreateLocaleDataBase( lc_db[i].db = p; } - new = (XlcDatabaseList)Xmalloc(sizeof(XlcDatabaseListRec)); + new = Xmalloc(sizeof(XlcDatabaseListRec)); if (new == (XlcDatabaseList)NULL) { goto err; } @@ -1330,7 +1331,7 @@ _XlcCreateLocaleDataBase( err: DestroyDatabase(database); if (lc_db != (XlcDatabase)NULL) { - Xfree((char *)lc_db); + Xfree(lc_db); } Xfree (name); return (XPointer)NULL; |