qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 2/3] qga/commands-win32: Do not set matrix_lookup_t/win_10


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH v3 2/3] qga/commands-win32: Do not set matrix_lookup_t/win_10_0_t arrays size
Date: Fri, 23 Feb 2024 18:49:11 +0100
User-agent: Mozilla Thunderbird

On 22/2/24 16:28, Philippe Mathieu-Daudé wrote:
ga_get_win_name() iterates over all elements in the arrays by
checking the 'version' field is non-NULL. Since the arrays are
guarded by a NULL terminating element, we don't need to specify
their size:

   static char *ga_get_win_name(...)
   {
       ...
       const ga_matrix_lookup_t *table = WIN_VERSION_MATRIX[tbl_idx];
       const ga_win_10_0_t *win_10_0_table = ...
       ...
       while (table->version != NULL) {
                     ^^^^^^^^^^^^^^^
               while (win_10_0_table->version != NULL) {
                                      ^^^^^^^^^^^^^^^

This will simplify maintenance when adding new entries to these
arrays.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
  qga/commands-win32.c | 19 +++++++++----------
  1 file changed, 9 insertions(+), 10 deletions(-)


  typedef struct _ga_win_10_0_t {
      int first_build;
-    const char *version;
-    const char *version_id;
+    char const *version;
+    char const *version_id;

Oops, missed rebase.

  } ga_win_10_0_t;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]