mirror of
https://github.com/pygos/pkg-utils.git
synced 2024-11-25 22:10:42 +01:00
32 lines
495 B
C
32 lines
495 B
C
|
#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;
|
||
|
}
|