[PATCH 2/5] msi: Get rid of the find_matching_rows() view operation.

Zebediah Figura z.figura12 at gmail.com
Thu Jan 24 00:07:30 CST 2019


It was introduced in 9f487ba1d as part of an optimization, but ceased to be used in a52c2bf94.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/msi/alter.c    |  9 -----
 dlls/msi/create.c   |  1 -
 dlls/msi/delete.c   | 10 ------
 dlls/msi/distinct.c | 22 -------------
 dlls/msi/drop.c     |  1 -
 dlls/msi/insert.c   | 10 ------
 dlls/msi/msipriv.h  | 13 --------
 dlls/msi/select.c   | 20 ------------
 dlls/msi/storages.c | 30 -----------------
 dlls/msi/streams.c  | 30 -----------------
 dlls/msi/table.c    | 80 ---------------------------------------------
 dlls/msi/update.c   |  9 -----
 dlls/msi/where.c    | 31 ------------------
 13 files changed, 266 deletions(-)

diff --git a/dlls/msi/alter.c b/dlls/msi/alter.c
index 8b11351f8b..8899c4499d 100644
--- a/dlls/msi/alter.c
+++ b/dlls/msi/alter.c
@@ -221,14 +221,6 @@ static UINT ALTER_delete( struct tagMSIVIEW *view )
     return ERROR_SUCCESS;
 }
 
-static UINT ALTER_find_matching_rows( struct tagMSIVIEW *view, UINT col,
-    UINT val, UINT *row, MSIITERHANDLE *handle )
-{
-    TRACE("%p, %d, %u, %p\n", view, col, val, *handle);
-
-    return ERROR_FUNCTION_FAILED;
-}
-
 static const MSIVIEWOPS alter_ops =
 {
     ALTER_fetch_int,
@@ -243,7 +235,6 @@ static const MSIVIEWOPS alter_ops =
     ALTER_get_column_info,
     ALTER_modify,
     ALTER_delete,
-    ALTER_find_matching_rows,
     NULL,
     NULL,
     NULL,
diff --git a/dlls/msi/create.c b/dlls/msi/create.c
index c679d6b131..0a60066d8e 100644
--- a/dlls/msi/create.c
+++ b/dlls/msi/create.c
@@ -142,7 +142,6 @@ static const MSIVIEWOPS create_ops =
     NULL,
     NULL,
     NULL,
-    NULL,
 };
 
 static UINT check_columns( const column_info *col_info )
diff --git a/dlls/msi/delete.c b/dlls/msi/delete.c
index 4472409a0a..4ed5384b8d 100644
--- a/dlls/msi/delete.c
+++ b/dlls/msi/delete.c
@@ -164,15 +164,6 @@ static UINT DELETE_delete( struct tagMSIVIEW *view )
     return ERROR_SUCCESS;
 }
 
-static UINT DELETE_find_matching_rows( struct tagMSIVIEW *view, UINT col,
-    UINT val, UINT *row, MSIITERHANDLE *handle )
-{
-    TRACE("%p, %d, %u, %p\n", view, col, val, *handle);
-
-    return ERROR_FUNCTION_FAILED;
-}
-
-
 static const MSIVIEWOPS delete_ops =
 {
     DELETE_fetch_int,
@@ -187,7 +178,6 @@ static const MSIVIEWOPS delete_ops =
     DELETE_get_column_info,
     DELETE_modify,
     DELETE_delete,
-    DELETE_find_matching_rows,
     NULL,
     NULL,
     NULL,
diff --git a/dlls/msi/distinct.c b/dlls/msi/distinct.c
index 04f09fa491..ff292f16bc 100644
--- a/dlls/msi/distinct.c
+++ b/dlls/msi/distinct.c
@@ -247,27 +247,6 @@ static UINT DISTINCT_delete( struct tagMSIVIEW *view )
     return ERROR_SUCCESS;
 }
 
-static UINT DISTINCT_find_matching_rows( struct tagMSIVIEW *view, UINT col,
-    UINT val, UINT *row, MSIITERHANDLE *handle )
-{
-    MSIDISTINCTVIEW *dv = (MSIDISTINCTVIEW*)view;
-    UINT r;
-
-    TRACE("%p, %d, %u, %p\n", view, col, val, *handle);
-
-    if( !dv->table )
-         return ERROR_FUNCTION_FAILED;
-
-    r = dv->table->ops->find_matching_rows( dv->table, col, val, row, handle );
-
-    if( *row > dv->row_count )
-        return ERROR_NO_MORE_ITEMS;
-
-    *row = dv->translation[ *row ];
-
-    return r;
-}
-
 static const MSIVIEWOPS distinct_ops =
 {
     DISTINCT_fetch_int,
@@ -282,7 +261,6 @@ static const MSIVIEWOPS distinct_ops =
     DISTINCT_get_column_info,
     DISTINCT_modify,
     DISTINCT_delete,
-    DISTINCT_find_matching_rows,
     NULL,
     NULL,
     NULL,
diff --git a/dlls/msi/drop.c b/dlls/msi/drop.c
index f0b58039fd..41dbc8d4e2 100644
--- a/dlls/msi/drop.c
+++ b/dlls/msi/drop.c
@@ -112,7 +112,6 @@ static const MSIVIEWOPS drop_ops =
     NULL,
     NULL,
     NULL,
-    NULL,
 };
 
 UINT DROP_CreateView(MSIDATABASE *db, MSIVIEW **view, LPCWSTR name)
diff --git a/dlls/msi/insert.c b/dlls/msi/insert.c
index c404929f28..0ae0cdc77f 100644
--- a/dlls/msi/insert.c
+++ b/dlls/msi/insert.c
@@ -318,15 +318,6 @@ static UINT INSERT_delete( struct tagMSIVIEW *view )
     return ERROR_SUCCESS;
 }
 
-static UINT INSERT_find_matching_rows( struct tagMSIVIEW *view, UINT col,
-    UINT val, UINT *row, MSIITERHANDLE *handle )
-{
-    TRACE("%p, %d, %u, %p\n", view, col, val, *handle);
-
-    return ERROR_FUNCTION_FAILED;
-}
-
-
 static const MSIVIEWOPS insert_ops =
 {
     INSERT_fetch_int,
@@ -341,7 +332,6 @@ static const MSIVIEWOPS insert_ops =
     INSERT_get_column_info,
     INSERT_modify,
     INSERT_delete,
-    INSERT_find_matching_rows,
     NULL,
     NULL,
     NULL,
diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h
index 90ce37091d..420fe43d81 100644
--- a/dlls/msi/msipriv.h
+++ b/dlls/msi/msipriv.h
@@ -301,19 +301,6 @@ typedef struct tagMSIVIEWOPS
      */
     UINT (*delete)( struct tagMSIVIEW * );
 
-    /*
-     * find_matching_rows - iterates through rows that match a value
-     *
-     * If the column type is a string then a string ID should be passed in.
-     *  If the value to be looked up is an integer then no transformation of
-     *  the input value is required, except if the column is a string, in which
-     *  case a string ID should be passed in.
-     * The handle is an input/output parameter that keeps track of the current
-     *  position in the iteration. It must be initialised to zero before the
-     *  first call and continued to be passed in to subsequent calls.
-     */
-    UINT (*find_matching_rows)( struct tagMSIVIEW *view, UINT col, UINT val, UINT *row, MSIITERHANDLE *handle );
-
     /*
      * add_ref - increases the reference count of the table
      */
diff --git a/dlls/msi/select.c b/dlls/msi/select.c
index e8f38855a8..70d2c32950 100644
--- a/dlls/msi/select.c
+++ b/dlls/msi/select.c
@@ -331,25 +331,6 @@ static UINT SELECT_delete( struct tagMSIVIEW *view )
     return ERROR_SUCCESS;
 }
 
-static UINT SELECT_find_matching_rows( struct tagMSIVIEW *view, UINT col,
-    UINT val, UINT *row, MSIITERHANDLE *handle )
-{
-    MSISELECTVIEW *sv = (MSISELECTVIEW*)view;
-
-    TRACE("%p, %d, %u, %p\n", view, col, val, *handle);
-
-    if( !sv->table )
-         return ERROR_FUNCTION_FAILED;
-
-    if( (col==0) || (col>sv->num_cols) )
-         return ERROR_FUNCTION_FAILED;
-
-    col = sv->cols[ col - 1 ];
-
-    return sv->table->ops->find_matching_rows( sv->table, col, val, row, handle );
-}
-
-
 static const MSIVIEWOPS select_ops =
 {
     SELECT_fetch_int,
@@ -364,7 +345,6 @@ static const MSIVIEWOPS select_ops =
     SELECT_get_column_info,
     SELECT_modify,
     SELECT_delete,
-    SELECT_find_matching_rows,
     NULL,
     NULL,
     NULL,
diff --git a/dlls/msi/storages.c b/dlls/msi/storages.c
index 3ca708cb5b..f0b960d7c8 100644
--- a/dlls/msi/storages.c
+++ b/dlls/msi/storages.c
@@ -415,35 +415,6 @@ static UINT STORAGES_delete(struct tagMSIVIEW *view)
     return ERROR_SUCCESS;
 }
 
-static UINT STORAGES_find_matching_rows(struct tagMSIVIEW *view, UINT col,
-                                       UINT val, UINT *row, MSIITERHANDLE *handle)
-{
-    MSISTORAGESVIEW *sv = (MSISTORAGESVIEW *)view;
-    UINT index = PtrToUlong(*handle);
-
-    TRACE("(%d, %d): %d\n", *row, col, val);
-
-    if (col == 0 || col > NUM_STORAGES_COLS)
-        return ERROR_INVALID_PARAMETER;
-
-    while (index < sv->num_rows)
-    {
-        if (sv->storages[index]->str_index == val)
-        {
-            *row = index;
-            break;
-        }
-
-        index++;
-    }
-
-    *handle = UlongToPtr(++index);
-    if (index >= sv->num_rows)
-        return ERROR_NO_MORE_ITEMS;
-
-    return ERROR_SUCCESS;
-}
-
 static const MSIVIEWOPS storages_ops =
 {
     STORAGES_fetch_int,
@@ -458,7 +429,6 @@ static const MSIVIEWOPS storages_ops =
     STORAGES_get_column_info,
     STORAGES_modify,
     STORAGES_delete,
-    STORAGES_find_matching_rows,
     NULL,
     NULL,
     NULL,
diff --git a/dlls/msi/streams.c b/dlls/msi/streams.c
index 74ef899c1b..e542d78844 100644
--- a/dlls/msi/streams.c
+++ b/dlls/msi/streams.c
@@ -337,35 +337,6 @@ static UINT STREAMS_delete(struct tagMSIVIEW *view)
     return ERROR_SUCCESS;
 }
 
-static UINT STREAMS_find_matching_rows(struct tagMSIVIEW *view, UINT col,
-                                       UINT val, UINT *row, MSIITERHANDLE *handle)
-{
-    MSISTREAMSVIEW *sv = (MSISTREAMSVIEW *)view;
-    UINT index = PtrToUlong(*handle);
-
-    TRACE("(%p, %d, %d, %p, %p)\n", view, col, val, row, handle);
-
-    if (!col || col > sv->num_cols)
-        return ERROR_INVALID_PARAMETER;
-
-    while (index < sv->db->num_streams)
-    {
-        if (sv->db->streams[index].str_index == val)
-        {
-            *row = index;
-            break;
-        }
-        index++;
-    }
-
-    *handle = UlongToPtr(++index);
-
-    if (index > sv->db->num_streams)
-        return ERROR_NO_MORE_ITEMS;
-
-    return ERROR_SUCCESS;
-}
-
 static const MSIVIEWOPS streams_ops =
 {
     STREAMS_fetch_int,
@@ -380,7 +351,6 @@ static const MSIVIEWOPS streams_ops =
     STREAMS_get_column_info,
     STREAMS_modify,
     STREAMS_delete,
-    STREAMS_find_matching_rows,
     NULL,
     NULL,
     NULL,
diff --git a/dlls/msi/table.c b/dlls/msi/table.c
index e046c5c9e2..e24b0bd0e5 100644
--- a/dlls/msi/table.c
+++ b/dlls/msi/table.c
@@ -1875,85 +1875,6 @@ static UINT TABLE_delete( struct tagMSIVIEW *view )
     return ERROR_SUCCESS;
 }
 
-static UINT TABLE_find_matching_rows( struct tagMSIVIEW *view, UINT col,
-    UINT val, UINT *row, MSIITERHANDLE *handle )
-{
-    MSITABLEVIEW *tv = (MSITABLEVIEW*)view;
-    const MSICOLUMNHASHENTRY *entry;
-
-    TRACE("%p, %d, %u, %p\n", view, col, val, *handle);
-
-    if( !tv->table )
-        return ERROR_INVALID_PARAMETER;
-
-    if( (col==0) || (col > tv->num_cols) )
-        return ERROR_INVALID_PARAMETER;
-
-    if( !tv->columns[col-1].hash_table )
-    {
-        UINT i;
-        UINT num_rows = tv->table->row_count;
-        MSICOLUMNHASHENTRY **hash_table;
-        MSICOLUMNHASHENTRY *new_entry;
-
-        if( tv->columns[col-1].offset >= tv->row_size )
-        {
-            ERR("Stuffed up %d >= %d\n", tv->columns[col-1].offset, tv->row_size );
-            ERR("%p %p\n", tv, tv->columns );
-            return ERROR_FUNCTION_FAILED;
-        }
-
-        /* allocate contiguous memory for the table and its entries so we
-         * don't have to do an expensive cleanup */
-        hash_table = msi_alloc(MSITABLE_HASH_TABLE_SIZE * sizeof(MSICOLUMNHASHENTRY*) +
-            num_rows * sizeof(MSICOLUMNHASHENTRY));
-        if (!hash_table)
-            return ERROR_OUTOFMEMORY;
-
-        memset(hash_table, 0, MSITABLE_HASH_TABLE_SIZE * sizeof(MSICOLUMNHASHENTRY*));
-        tv->columns[col-1].hash_table = hash_table;
-
-        new_entry = (MSICOLUMNHASHENTRY *)(hash_table + MSITABLE_HASH_TABLE_SIZE);
-
-        for (i = 0; i < num_rows; i++, new_entry++)
-        {
-            UINT row_value;
-
-            if (view->ops->fetch_int( view, i, col, &row_value ) != ERROR_SUCCESS)
-                continue;
-
-            new_entry->next = NULL;
-            new_entry->value = row_value;
-            new_entry->row = i;
-            if (hash_table[row_value % MSITABLE_HASH_TABLE_SIZE])
-            {
-                MSICOLUMNHASHENTRY *prev_entry = hash_table[row_value % MSITABLE_HASH_TABLE_SIZE];
-                while (prev_entry->next)
-                    prev_entry = prev_entry->next;
-                prev_entry->next = new_entry;
-            }
-            else
-                hash_table[row_value % MSITABLE_HASH_TABLE_SIZE] = new_entry;
-        }
-    }
-
-    if( !*handle )
-        entry = tv->columns[col-1].hash_table[val % MSITABLE_HASH_TABLE_SIZE];
-    else
-        entry = (*handle)->next;
-
-    while (entry && entry->value != val)
-        entry = entry->next;
-
-    *handle = entry;
-    if (!entry)
-        return ERROR_NO_MORE_ITEMS;
-
-    *row = entry->row;
-
-    return ERROR_SUCCESS;
-}
-
 static UINT TABLE_add_ref(struct tagMSIVIEW *view)
 {
     MSITABLEVIEW *tv = (MSITABLEVIEW*)view;
@@ -2148,7 +2069,6 @@ static const MSIVIEWOPS table_ops =
     TABLE_get_column_info,
     TABLE_modify,
     TABLE_delete,
-    TABLE_find_matching_rows,
     TABLE_add_ref,
     TABLE_release,
     TABLE_add_column,
diff --git a/dlls/msi/update.c b/dlls/msi/update.c
index d0e3c28f79..ed81447aa5 100644
--- a/dlls/msi/update.c
+++ b/dlls/msi/update.c
@@ -195,14 +195,6 @@ static UINT UPDATE_delete( struct tagMSIVIEW *view )
     return ERROR_SUCCESS;
 }
 
-static UINT UPDATE_find_matching_rows( struct tagMSIVIEW *view, UINT col, UINT val, UINT *row, MSIITERHANDLE *handle )
-{
-    TRACE("%p %d %d %p\n", view, col, val, *handle );
-
-    return ERROR_FUNCTION_FAILED;
-}
-
-
 static const MSIVIEWOPS update_ops =
 {
     UPDATE_fetch_int,
@@ -217,7 +209,6 @@ static const MSIVIEWOPS update_ops =
     UPDATE_get_column_info,
     UPDATE_modify,
     UPDATE_delete,
-    UPDATE_find_matching_rows,
     NULL,
     NULL,
     NULL,
diff --git a/dlls/msi/where.c b/dlls/msi/where.c
index ddd8c07fab..b493bda7dd 100644
--- a/dlls/msi/where.c
+++ b/dlls/msi/where.c
@@ -1015,36 +1015,6 @@ static UINT WHERE_delete( struct tagMSIVIEW *view )
     return ERROR_SUCCESS;
 }
 
-static UINT WHERE_find_matching_rows( struct tagMSIVIEW *view, UINT col,
-    UINT val, UINT *row, MSIITERHANDLE *handle )
-{
-    MSIWHEREVIEW *wv = (MSIWHEREVIEW*)view;
-    UINT i, row_value;
-
-    TRACE("%p, %d, %u, %p\n", view, col, val, *handle);
-
-    if (!wv->tables)
-         return ERROR_FUNCTION_FAILED;
-
-    if (col == 0 || col > wv->col_count)
-        return ERROR_INVALID_PARAMETER;
-
-    for (i = PtrToUlong(*handle); i < wv->row_count; i++)
-    {
-        if (view->ops->fetch_int( view, i, col, &row_value ) != ERROR_SUCCESS)
-            continue;
-
-        if (row_value == val)
-        {
-            *row = i;
-            *handle = UlongToPtr(i + 1);
-            return ERROR_SUCCESS;
-        }
-    }
-
-    return ERROR_NO_MORE_ITEMS;
-}
-
 static UINT WHERE_sort(struct tagMSIVIEW *view, column_info *columns)
 {
     MSIWHEREVIEW *wv = (MSIWHEREVIEW *)view;
@@ -1108,7 +1078,6 @@ static const MSIVIEWOPS where_ops =
     WHERE_get_column_info,
     WHERE_modify,
     WHERE_delete,
-    WHERE_find_matching_rows,
     NULL,
     NULL,
     NULL,
-- 
2.17.1




More information about the wine-devel mailing list