/* Returns a valid pointer into @node on success. Returns NULL on failure (bad input) and sets *@keylen = 0  */
static char * befs_bt_get_key(struct super_block *sb, befs_btree_node *node, int index, u16 *keylen)
/* Returns a valid pointer into @node on success. Returns NULL on failure (bad input) and sets *@keylen = 0  */
static char * befs_bt_get_key(struct super_block *sb, befs_btree_node *node, int index, u16 *keylen)
{
	int prev_key_end;
	char *keystart;
	fs16 *keylen_index;
	if (index < 0 || index > node->head.all_key_count) {
		*keylen = 0;
		return NULL;
	}
	keystart = befs_bt_keydata(node);
	keylen_index = befs_bt_keylen_index(node);
	if (index == 0)
		prev_key_end = 0;
	else
		prev_key_end = fs16_to_cpu(sb, keylen_index[index - 1]);
	*keylen = fs16_to_cpu(sb, keylen_index[index]) - prev_key_end;
	return keystart + prev_key_end;
}