From patchwork Tue Aug 9 12:02:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 73547 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp447472qga; Tue, 9 Aug 2016 05:03:08 -0700 (PDT) X-Received: by 10.55.149.1 with SMTP id x1mr35711299qkd.270.1470744187919; Tue, 09 Aug 2016 05:03:07 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id p135si20683599qka.233.2016.08.09.05.03.07; Tue, 09 Aug 2016 05:03:07 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 4AB7060F15; Tue, 9 Aug 2016 12:03:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 9905360BE6; Tue, 9 Aug 2016 12:03:05 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 3D17E60E44; Tue, 9 Aug 2016 12:03:04 +0000 (UTC) Received: from mail-wm0-f51.google.com (mail-wm0-f51.google.com [74.125.82.51]) by lists.linaro.org (Postfix) with ESMTPS id 4C49E60667 for ; Tue, 9 Aug 2016 12:02:59 +0000 (UTC) Received: by mail-wm0-f51.google.com with SMTP id o80so30026175wme.1 for ; Tue, 09 Aug 2016 05:02:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=CjdyaacVh+wYb9Oxqr5RLFmhWDIhpqXCmvsC764y4SU=; b=GOGE+viKllDLansOZLyZoBSTmZ3gMJAEgQmn8qxlAzvfjoQ4DD/jlF09lwNGjMV3z9 aNgQ/P7ZunlUOofK4eRCWNs7pkkAx16iATJkOQcSdoo6ZcMbtPXtZGwoX5V6uaLZwQFR g/k971KA6E1tf0650r0/5jbKFRmstFW9rerrZt/NTY6nYvhu2jpot1YA4oULvqEzK8cd 4jo6j6uP/+7tVbbuD0RKqMPVwU2RrS7C2ZxBwe8LRMWCQswzeRZGthi8u8wzrj8M4/mH LqXnWikSjzYqHfQZJ1PABAH+AfH1u4qz7XomGUpKZp94kprKoioL4nN2VorcOEyoMHgF RpUw== X-Gm-Message-State: AEkoousotd6ynTt1aeMu1JKuZwo+pEkys/FTB4mHeCd0aWctXHEZPXZMEJtbNAl8fEdNZkGms3A= X-Received: by 10.25.211.130 with SMTP id k124mr32343739lfg.175.1470744178312; Tue, 09 Aug 2016 05:02:58 -0700 (PDT) Received: from localhost.localdomain ([83.220.237.206]) by smtp.gmail.com with ESMTPSA id e22sm6438954lji.1.2016.08.09.05.02.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 09 Aug 2016 05:02:57 -0700 (PDT) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Tue, 9 Aug 2016 15:02:53 +0300 Message-Id: <1470744173-8719-1-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 2.7.1.250.gff4ea60 X-Topics: patch Subject: [lng-odp] [PATCH] helper: hashtable: clean up internal functions name X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" No need for prefix for not interface local static functions. Suggested-by: Anders Roxell Signed-off-by: Maxim Uvarov --- helper/hashtable.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) -- 2.7.1.250.gff4ea60 diff --git a/helper/hashtable.c b/helper/hashtable.c index 8bb1ae5..9097c51 100644 --- a/helper/hashtable.c +++ b/helper/hashtable.c @@ -164,7 +164,7 @@ odph_table_t odph_hash_table_lookup(const char *name) * This hash algorithm is the most simple one, so we choose it as an DEMO * User can use any other algorithm, like CRC... */ -uint16_t odp_key_hash(void *key, uint32_t key_size) +static uint16_t key_hash(void *key, uint32_t key_size) { register uint32_t hash = 0; uint32_t idx = (key_size == 0 ? 1 : key_size); @@ -181,7 +181,7 @@ uint16_t odp_key_hash(void *key, uint32_t key_size) /** * Get an available node from pool */ -odph_hash_node *odp_hashnode_take(odph_table_t table) +static odph_hash_node *hashnode_take(odph_table_t table) { odph_hash_table_imp *tbl = (odph_hash_table_imp *)table; uint32_t idx; @@ -208,7 +208,7 @@ odph_hash_node *odp_hashnode_take(odph_table_t table) /** * Release an node to the pool */ -void odp_hashnode_give(odph_table_t table, odph_hash_node *node) +void odph_hashnode_give(odph_table_t table, odph_hash_node *node) { odph_hash_table_imp *tbl = (odph_hash_table_imp *)table; @@ -232,7 +232,7 @@ int odph_hash_put_value(odph_table_t table, void *key, void *value) return ODPH_FAIL; /* hash value is just the index of the list head in pool */ - hash = odp_key_hash(key, tbl->key_size); + hash = key_hash(key, tbl->key_size); odp_rwlock_write_lock(&tbl->lock_pool[hash]); /* First, check if the key already exist */ @@ -249,7 +249,7 @@ int odph_hash_put_value(odph_table_t table, void *key, void *value) } /*if the key is a new one, get a new hash node form the pool */ - node = odp_hashnode_take(table); + node = hashnode_take(table); if (node == NULL) { odp_rwlock_write_unlock(&tbl->lock_pool[hash]); return ODPH_FAIL; @@ -281,7 +281,7 @@ int odph_hash_get_value(odph_table_t table, void *key, void *buffer, return ODPH_FAIL; /* hash value is just the index of the list head in pool */ - hash = odp_key_hash(key, tbl->key_size); + hash = key_hash(key, tbl->key_size); odp_rwlock_read_lock(&tbl->lock_pool[hash]); @@ -316,7 +316,7 @@ int odph_hash_remove_value(odph_table_t table, void *key) return ODPH_FAIL; /* hash value is just the index of the list head in pool */ - hash = odp_key_hash(key, tbl->key_size); + hash = key_hash(key, tbl->key_size); odp_rwlock_write_lock(&tbl->lock_pool[hash]); @@ -324,7 +324,7 @@ int odph_hash_remove_value(odph_table_t table, void *key) list_node) { if (memcmp(node->content, key, tbl->key_size) == 0) { - odp_hashnode_give(table, node); + odph_hashnode_give(table, node); odp_rwlock_write_unlock(&tbl->lock_pool[hash]); return ODPH_SUCCESS; }