#include "stdinc.h"
#include "capability.h"
#include "irc_dictionary.h"
+#include "s_assert.h"
static rb_dlink_list capability_indexes = { NULL, NULL, 0 };
struct CapabilityEntry *entry;
s_assert(idx != NULL);
+ if (cap == NULL)
+ return 0;
entry = irc_dictionary_retrieve(idx->cap_dict, cap);
if (entry != NULL && !(entry->flags & CAP_ORPHANED))
return (1 << entry->value);
}
+unsigned int
+capability_put_anonymous(struct CapabilityIndex *idx)
+{
+ unsigned int value;
+
+ s_assert(idx != NULL);
+ if (!idx->highest_bit)
+ return 0xFFFFFFFF;
+ value = 1 << idx->highest_bit;
+ idx->highest_bit++;
+ if (idx->highest_bit % (sizeof(unsigned int) * 8) == 0)
+ idx->highest_bit = 0;
+ return value;
+}
+
void
capability_orphan(struct CapabilityIndex *idx, const char *cap)
{
cb(buf, privdata);
}
- rb_snprintf(buf, sizeof buf, "'%s': remaining bits - %ld", idx->name,
- (sizeof(unsigned int) * 8) - (idx->highest_bit - 1));
+ rb_snprintf(buf, sizeof buf, "'%s': remaining bits - %u", idx->name,
+ (unsigned int)((sizeof(unsigned int) * 8) - (idx->highest_bit - 1)));
cb(buf, privdata);
}