summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatt Dunwoodie <ncon@mail.noconroy.net>2019-09-02 21:20:12 +1000
committerMatt Dunwoodie <ncon@mail.noconroy.net>2019-09-02 21:20:12 +1000
commit0882bb6b75ce99c091941d97a88b92f86d1168ea (patch)
tree4cb9aaf6fb130a6a842bcef02033195bb31cf502 /src
parentCleanup crypto patches (diff)
downloadwireguard-openbsd-0882bb6b75ce99c091941d97a88b92f86d1168ea.tar.xz
wireguard-openbsd-0882bb6b75ce99c091941d97a88b92f86d1168ea.zip
Uppercase macros in fixedmap.h
Diffstat (limited to 'src')
-rw-r--r--src/fixedmap.h28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/fixedmap.h b/src/fixedmap.h
index aa7430c3ed9..076628dd412 100644
--- a/src/fixedmap.h
+++ b/src/fixedmap.h
@@ -43,8 +43,8 @@ uint32_t fm_insert(struct fixed_map *, void *);
void *fm_lookup(struct fixed_map *, uint32_t);
void fm_remove(struct fixed_map *, uint32_t);
-#define fm_size(fm) (1 << (fm)->bits)
-#define fm_item(fm, k) ((fm)->map[(k) & ((fm)->bits - 1)])
+#define FM_SIZE(fm) (1 << (fm)->bits)
+#define FM_ITEM(fm, k) ((fm)->map[(k) & ((fm)->bits - 1)])
void
fm_init(struct fixed_map *fm)
@@ -66,19 +66,19 @@ fm_resize(struct fixed_map *fm, size_t size)
struct map_item *old_map;
size_t old_size, i;
- if (size <= fm_size(fm))
+ if (size <= FM_SIZE(fm))
return;
rw_enter_write(&fm->lock);
- old_size = fm_size(fm);
+ old_size = FM_SIZE(fm);
old_map = fm->map;
for(fm->bits = 1; size >>= 1; fm->bits++);
- fm->map = mallocarray(fm_size(fm), sizeof(*fm->map), M_DEVBUF, M_WAITOK | M_ZERO);
+ fm->map = mallocarray(FM_SIZE(fm), sizeof(*fm->map), M_DEVBUF, M_WAITOK | M_ZERO);
if (old_map != NULL) {
for (i = 0; i < old_size; i++)
- fm_item(fm, old_map[i].key) = old_map[i];
+ FM_ITEM(fm, old_map[i].key) = old_map[i];
free(old_map, M_DEVBUF, 0);
}
rw_exit_write(&fm->lock);
@@ -91,7 +91,7 @@ fm_reserve(struct fixed_map *fm)
struct map_item *item = NULL;
rw_enter_write(&fm->lock);
- for (i = 0; i < fm_size(fm); i++) {
+ for (i = 0; i < FM_SIZE(fm); i++) {
if (fm->map[i].state == FM_ITEM_EMPTY) {
item = &fm->map[i];
break;
@@ -112,9 +112,9 @@ void
fm_set(struct fixed_map *fm, uint32_t k, void *v)
{
rw_enter_write(&fm->lock);
- if (fm_item(fm, k).key == k ) {
- fm_item(fm, k).value = v;
- fm_item(fm, k).state = FM_ITEM_FILLED;
+ if (FM_ITEM(fm, k).key == k ) {
+ FM_ITEM(fm, k).value = v;
+ FM_ITEM(fm, k).state = FM_ITEM_FILLED;
}
rw_exit_write(&fm->lock);
}
@@ -132,7 +132,7 @@ fm_lookup(struct fixed_map *fm, uint32_t k)
{
void *v;
rw_enter_read(&fm->lock);
- v = fm_item(fm, k).key == k ? fm_item(fm, k).value : NULL;
+ v = FM_ITEM(fm, k).key == k ? FM_ITEM(fm, k).value : NULL;
rw_exit_read(&fm->lock);
return v;
}
@@ -141,9 +141,9 @@ void
fm_remove(struct fixed_map *fm, uint32_t k)
{
rw_enter_write(&fm->lock);
- if (fm_item(fm, k).key == k) {
- fm_item(fm, k).value = NULL;
- fm_item(fm, k).state = FM_ITEM_EMPTY;
+ if (FM_ITEM(fm, k).key == k) {
+ FM_ITEM(fm, k).value = NULL;
+ FM_ITEM(fm, k).state = FM_ITEM_EMPTY;
}
rw_exit_write(&fm->lock);
}