mirror of
https://github.com/pygos/pkg-utils.git
synced 2024-11-24 21:40:43 +01:00
32 lines
530 B
C
32 lines
530 B
C
/* SPDX-License-Identifier: ISC */
|
|
#include <string.h>
|
|
|
|
#include "compressor.h"
|
|
|
|
static compressor_t *list = NULL;
|
|
|
|
void compressor_register(compressor_t *compressor)
|
|
{
|
|
compressor->next = list;
|
|
list = compressor;
|
|
}
|
|
|
|
compressor_t *compressor_by_name(const char *name)
|
|
{
|
|
compressor_t *it = list;
|
|
|
|
while (it != NULL && strcmp(it->name, name) != 0)
|
|
it = it->next;
|
|
|
|
return it;
|
|
}
|
|
|
|
compressor_t *compressor_by_id(PKG_COMPRESSION id)
|
|
{
|
|
compressor_t *it = list;
|
|
|
|
while (it != NULL && it->id != id)
|
|
it = it->next;
|
|
|
|
return it;
|
|
}
|