mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-16 06:59:55 -05:00
database: extract common method to handle machine id and architecture
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/425>
This commit is contained in:
parent
0efae0488c
commit
0ac6b16787
12 changed files with 154 additions and 65 deletions
|
|
@ -222,14 +222,21 @@ static int fill_data(simple_data *db, FILE *f) {
|
|||
return pa_hashmap_size(db->map);
|
||||
}
|
||||
|
||||
pa_database* pa_database_open(const char *fn, bool for_write) {
|
||||
const char* pa_database_get_arch_suffix(void) {
|
||||
/* Simple database binary file format is CPU dependent. */
|
||||
return CANONICAL_HOST;
|
||||
}
|
||||
|
||||
const char* pa_database_get_filename_suffix(void) {
|
||||
return ".simple";
|
||||
}
|
||||
|
||||
pa_database* pa_database_open_internal(const char *path, bool for_write) {
|
||||
FILE *f;
|
||||
char *path;
|
||||
simple_data *db;
|
||||
|
||||
pa_assert(fn);
|
||||
pa_assert(path);
|
||||
|
||||
path = pa_sprintf_malloc("%s."CANONICAL_HOST".simple", fn);
|
||||
errno = 0;
|
||||
|
||||
f = pa_fopen_cloexec(path, "r");
|
||||
|
|
@ -251,8 +258,6 @@ pa_database* pa_database_open(const char *fn, bool for_write) {
|
|||
db = NULL;
|
||||
}
|
||||
|
||||
pa_xfree(path);
|
||||
|
||||
return (pa_database*) db;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue