Alexandre Julliard : wrc: Store version and characteristics as simple integers.
Alexandre Julliard
julliard at winehq.org
Fri Apr 1 16:04:28 CDT 2022
Module: wine
Branch: master
Commit: d0b7fa9da7539847ebfc6960ff2aedc762218c1d
URL: https://source.winehq.org/git/wine.git/?a=commit;h=d0b7fa9da7539847ebfc6960ff2aedc762218c1d
Author: Alexandre Julliard <julliard at winehq.org>
Date: Fri Apr 1 12:58:15 2022 +0200
wrc: Store version and characteristics as simple integers.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
tools/wrc/genres.c | 12 ++++++------
tools/wrc/newstruc.c | 26 --------------------------
tools/wrc/newstruc.h | 4 ----
tools/wrc/parser.y | 32 ++++++++++++++++----------------
tools/wrc/po.c | 4 ++--
tools/wrc/wrctypes.h | 8 ++++----
6 files changed, 28 insertions(+), 58 deletions(-)
diff --git a/tools/wrc/genres.c b/tools/wrc/genres.c
index 5282c809f85..81e7a52c9a9 100644
--- a/tools/wrc/genres.c
+++ b/tools/wrc/genres.c
@@ -247,17 +247,17 @@ static void put_name_id(name_id_t *nid, int upcase, language_t lang)
static void put_lvc(lvc_t *lvc)
{
if(lvc)
+ {
put_word(lvc->language);
+ put_dword(lvc->version);
+ put_dword(lvc->characts);
+ }
else
+ {
put_word(0); /* Neutral */
- if(lvc && lvc->version)
- put_dword(*lvc->version);
- else
put_dword(0);
- if(lvc && lvc->characts)
- put_dword(*lvc->characts);
- else
put_dword(0);
+ }
}
/*
diff --git a/tools/wrc/newstruc.c b/tools/wrc/newstruc.c
index b1cd9183640..9602cdfbf92 100644
--- a/tools/wrc/newstruc.c
+++ b/tools/wrc/newstruc.c
@@ -196,32 +196,6 @@ resource_t *new_resource(enum res_e t, void *res, int memopt, language_t lan)
return r;
}
-version_t *new_version(unsigned int v)
-{
- version_t *vp = xmalloc(sizeof(version_t));
- *vp = v;
- return vp;
-}
-
-characts_t *new_characts(unsigned int c)
-{
- characts_t *cp = xmalloc(sizeof(characts_t));
- *cp = c;
- return cp;
-}
-
-version_t *dup_version(version_t *v)
-{
- if(!v) return NULL;
- return new_version(*v);
-}
-
-characts_t *dup_characts(characts_t *c)
-{
- if(!c) return NULL;
- return new_characts(*c);
-}
-
html_t *new_html(raw_data_t *rd, int *memopt)
{
html_t *html = xmalloc(sizeof(html_t));
diff --git a/tools/wrc/newstruc.h b/tools/wrc/newstruc.h
index dd3215eba8d..7ed386916ab 100644
--- a/tools/wrc/newstruc.h
+++ b/tools/wrc/newstruc.h
@@ -43,10 +43,6 @@ string_t *new_string(void);
toolbar_item_t *new_toolbar_item(void);
ani_any_t *new_ani_any(void);
resource_t *new_resource(enum res_e t, void *res, int memopt, language_t lan);
-version_t *new_version(unsigned int v);
-characts_t *new_characts(unsigned int c);
-version_t *dup_version(version_t *v);
-characts_t *dup_characts(characts_t *c);
html_t *new_html(raw_data_t *rd, int *memopt);
rcdata_t *new_rcdata(raw_data_t *rd, int *memopt);
font_id_t *new_font_id(int size, string_t *face, int weight, int italic);
diff --git a/tools/wrc/parser.y b/tools/wrc/parser.y
index d13d89cdd41..6b362b06b6b 100644
--- a/tools/wrc/parser.y
+++ b/tools/wrc/parser.y
@@ -155,8 +155,8 @@ static int dont_want_id = 0; /* See language parsing for details */
/* Set to the current options of the currently scanning stringtable */
static int *tagstt_memopt;
-static characts_t *tagstt_characts;
-static version_t *tagstt_version;
+static characts_t tagstt_characts;
+static version_t tagstt_version;
static const char riff[4] = "RIFF"; /* RIFF file magic for animated cursor/icon */
@@ -180,8 +180,8 @@ static event_t *add_string_event(string_t *key, int id, int flags, event_t *prev
static event_t *add_event(int key, int id, int flags, event_t *prev);
static name_id_t *convert_ctlclass(name_id_t *cls);
static control_t *ins_ctrl(int type, int special_style, control_t *ctrl, control_t *prev);
-static dialog_t *dialog_version(version_t *v, dialog_t *dlg);
-static dialog_t *dialog_characteristics(characts_t *c, dialog_t *dlg);
+static dialog_t *dialog_version(version_t v, dialog_t *dlg);
+static dialog_t *dialog_characteristics(characts_t c, dialog_t *dlg);
static dialog_t *dialog_language(language_t l, dialog_t *dlg);
static dialog_t *dialog_menu(name_id_t *m, dialog_t *dlg);
static dialog_t *dialog_class(name_id_t *n, dialog_t *dlg);
@@ -228,8 +228,8 @@ static int rsrcid_to_token(int lookahead);
name_id_t *nid;
font_id_t *fntid;
language_t lan;
- version_t *ver;
- characts_t *chars;
+ version_t ver;
+ characts_t chars;
event_t *event;
menu_item_t *menitm;
itemex_opt_t *exopt;
@@ -1727,11 +1727,11 @@ opt_language
;
opt_characts
- : tCHARACTERISTICS expr { $$ = new_characts($2); }
+ : tCHARACTERISTICS expr { $$ = $2; }
;
opt_version
- : tVERSION expr { $$ = new_version($2); }
+ : tVERSION expr { $$ = $2; }
;
/* ------------------------------ Raw data handling ------------------------------ */
@@ -1895,7 +1895,7 @@ static dialog_t *dialog_language(language_t l, dialog_t *dlg)
return dlg;
}
-static dialog_t *dialog_characteristics(characts_t *c, dialog_t *dlg)
+static dialog_t *dialog_characteristics(characts_t c, dialog_t *dlg)
{
assert(dlg != NULL);
if(dlg->lvc.characts)
@@ -1904,7 +1904,7 @@ static dialog_t *dialog_characteristics(characts_t *c, dialog_t *dlg)
return dlg;
}
-static dialog_t *dialog_version(version_t *v, dialog_t *dlg)
+static dialog_t *dialog_version(version_t v, dialog_t *dlg)
{
assert(dlg != NULL);
if(dlg->lvc.version)
@@ -2369,8 +2369,8 @@ static resource_t *build_stt_resources(stringtable_t *stthead)
int j;
unsigned int andsum;
unsigned int orsum;
- characts_t *characts;
- version_t *version;
+ characts_t characts;
+ version_t version;
if(!stthead)
return NULL;
@@ -2401,8 +2401,8 @@ static resource_t *build_stt_resources(stringtable_t *stthead)
}
andsum = ~0;
orsum = 0;
- characts = NULL;
- version = NULL;
+ characts = 0;
+ version = 0;
/* Check individual memory options and get
* the first characteristics/version
*/
@@ -2426,11 +2426,11 @@ static resource_t *build_stt_resources(stringtable_t *stthead)
{
if(characts
&& newstt->entries[j].characts
- && *newstt->entries[j].characts != *characts)
+ && newstt->entries[j].characts != characts)
warning("Stringtable's characteristics are not the same (idbase: %d)\n", newstt->idbase);
if(version
&& newstt->entries[j].version
- && *newstt->entries[j].version != *version)
+ && newstt->entries[j].version != version)
warning("Stringtable's versions are not the same (idbase: %d)\n", newstt->idbase);
}
rsc = new_resource(res_stt, newstt, newstt->memopt, newstt->lvc.language);
diff --git a/tools/wrc/po.c b/tools/wrc/po.c
index 4d472a12a64..266dd3ec2e4 100644
--- a/tools/wrc/po.c
+++ b/tools/wrc/po.c
@@ -86,10 +86,10 @@ static language_t get_default_sublang( language_t lan )
}
}
-static version_t *get_dup_version( language_t lang )
+static version_t get_dup_version( language_t lang )
{
/* English "translations" take precedence over the original rc contents */
- return new_version( is_english( lang ) ? 1 : -1 );
+ return is_english( lang ) ? 1 : -1;
}
static name_id_t *dup_name_id( name_id_t *id )
diff --git a/tools/wrc/wrctypes.h b/tools/wrc/wrctypes.h
index 2415ce5f294..b453e2fdb08 100644
--- a/tools/wrc/wrctypes.h
+++ b/tools/wrc/wrctypes.h
@@ -108,8 +108,8 @@ typedef unsigned int version_t;
typedef struct lvc {
language_t language;
- version_t *version;
- characts_t *characts;
+ version_t version;
+ characts_t characts;
} lvc_t;
typedef struct font_id {
@@ -428,8 +428,8 @@ typedef struct stt_entry {
string_t *str;
int id;
unsigned int memopt;
- characts_t *characts;
- version_t *version;
+ characts_t characts;
+ version_t version;
} stt_entry_t;
typedef struct stringtable {
More information about the wine-cvs
mailing list