ssb: Follow + block = block.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 9m4s
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 9m4s
This commit is contained in:
40
src/ssb.db.c
40
src/ssb.db.c
@@ -1597,8 +1597,10 @@ typedef struct _following_t
|
||||
int depth;
|
||||
following_t** following;
|
||||
following_t** blocking;
|
||||
following_t** both;
|
||||
int following_count;
|
||||
int blocking_count;
|
||||
int both_count;
|
||||
int ref_count;
|
||||
int block_ref_count;
|
||||
} following_t;
|
||||
@@ -1715,14 +1717,27 @@ static void _populate_follows_and_blocks(
|
||||
{
|
||||
if (_add_following_entry(&entry->following, &entry->following_count, next))
|
||||
{
|
||||
next->ref_count++;
|
||||
if (next->ref_count++ == 0 && next->block_ref_count)
|
||||
{
|
||||
if (_remove_following_entry(&entry->blocking, &entry->blocking_count, next))
|
||||
{
|
||||
_remove_following_entry(&entry->following, &entry->following_count, next);
|
||||
_add_following_entry(&entry->both, &entry->both_count, next);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_remove_following_entry(&entry->following, &entry->following_count, next))
|
||||
{
|
||||
next->ref_count--;
|
||||
if (next->ref_count-- == 1 && next->block_ref_count)
|
||||
{
|
||||
if (_remove_following_entry(&entry->both, &entry->both_count, next))
|
||||
{
|
||||
_add_following_entry(&entry->blocking, &entry->blocking_count, next);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1737,14 +1752,29 @@ static void _populate_follows_and_blocks(
|
||||
{
|
||||
if (_add_following_entry(&entry->blocking, &entry->blocking_count, next))
|
||||
{
|
||||
next->block_ref_count++;
|
||||
if (next->block_ref_count++ == 0 && next->ref_count)
|
||||
{
|
||||
if (_remove_following_entry(&entry->following, &entry->following_count, next))
|
||||
{
|
||||
next->ref_count--;
|
||||
_remove_following_entry(&entry->blocking, &entry->blocking_count, next);
|
||||
_add_following_entry(&entry->both, &entry->both_count, next);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_remove_following_entry(&entry->blocking, &entry->blocking_count, next))
|
||||
{
|
||||
next->block_ref_count--;
|
||||
if (next->block_ref_count-- == 1)
|
||||
{
|
||||
if (_remove_following_entry(&entry->both, &entry->both_count, next))
|
||||
{
|
||||
next->ref_count++;
|
||||
_add_following_entry(&entry->following, &entry->following_count, next);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1841,6 +1871,7 @@ tf_ssb_following_t* tf_ssb_db_following_deep(tf_ssb_t* ssb, const char** ids, in
|
||||
{
|
||||
tf_free(following[i]->following);
|
||||
tf_free(following[i]->blocking);
|
||||
tf_free(following[i]->both);
|
||||
tf_free(following[i]);
|
||||
}
|
||||
tf_free(following);
|
||||
@@ -1892,6 +1923,7 @@ const char** tf_ssb_db_following_deep_ids(tf_ssb_t* ssb, const char** ids, int c
|
||||
{
|
||||
tf_free(following[i]->following);
|
||||
tf_free(following[i]->blocking);
|
||||
tf_free(following[i]->both);
|
||||
tf_free(following[i]);
|
||||
}
|
||||
tf_free(following);
|
||||
|
||||
Reference in New Issue
Block a user