Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
lektor
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté GitLab
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Kubat
lektor
Validations
bc2f9fff
Vérifiée
Valider
bc2f9fff
rédigé
Il y a 4 ans
par
Kubat
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
MODULE: One more function should works and use the json parser [no-build]
parent
d725c3bc
Branches
Branches contenant la validation
Aucune étiquette associée trouvée
1 requête de fusion
!130
Resolve "Remove json-c"
Modifications
1
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
1 fichier modifié
src/module/module_repo.c
+34
-24
34 ajouts, 24 suppressions
src/module/module_repo.c
avec
34 ajouts
et
24 suppressions
src/module/module_repo.c
+
34
−
24
Voir le fichier @
bc2f9fff
...
@@ -80,6 +80,12 @@ struct module_repo_internal {
...
@@ -80,6 +80,12 @@ struct module_repo_internal {
void
(
*
craft_filename
)(
char
str
[
PATH_MAX
],
size_t
,
struct
kara
*
);
void
(
*
craft_filename
)(
char
str
[
PATH_MAX
],
size_t
,
struct
kara
*
);
};
};
struct
__uri
{
char
*
fav
;
struct
module_repo_internal
*
repo
;
struct
lkt_uri
uri
;
};
struct
__memory
{
struct
__memory
{
void
*
mem
;
void
*
mem
;
size_t
size
;
size_t
size
;
...
@@ -510,10 +516,27 @@ end_no_lock:
...
@@ -510,10 +516,27 @@ end_no_lock:
pthread_exit
(
NULL
);
pthread_exit
(
NULL
);
}
}
static
void
__handle_fav_list_internal
(
const
char
UNUSED
*
key
,
const
char
*
val
,
int
comp
,
void
*
user
)
{
if
(
comp
)
{
/* Already processed because we only want one line */
return
;
}
struct
__uri
*
uri
=
(
struct
__uri
*
)
user
;
uri
->
uri
.
id
=
strtol
(
val
,
NULL
,
0
);
if
(
!
database_plt_add_uri
(
uri
->
repo
->
db
,
uri
->
fav
,
&
uri
->
uri
))
{
LOG_ERROR
(
"REPO"
,
"Failed to add kara %ld to playlist %s"
,
uri
->
uri
.
id
,
uri
->
fav
);
return
;
}
}
static
inline
void
static
inline
void
__handle_fav_list
(
struct
module_repo_internal
*
repo
,
char
*
fav
,
size_t
fav_size
)
__handle_fav_list
(
struct
module_repo_internal
*
repo
,
char
*
fav
,
size_t
fav_size
)
{
{
struct
json_object
*
json
,
*
item_json
=
NULL
;
char
*
json
;
char
fav_url
[
LKT_LINE_MAX
];
char
fav_url
[
LKT_LINE_MAX
];
char
*
fav_origin
=
NULL
;
char
*
fav_origin
=
NULL
;
...
@@ -537,32 +560,19 @@ __handle_fav_list(struct module_repo_internal *repo, char *fav, size_t fav_size)
...
@@ -537,32 +560,19 @@ __handle_fav_list(struct module_repo_internal *repo, char *fav, size_t fav_size)
}
}
database_plt_touch
(
repo
->
db
,
fav
);
database_plt_touch
(
repo
->
db
,
fav
);
struct
lkt_uri
uri
=
{
struct
__uri
uri
=
{
.
fav
=
fav
,
.
repo
=
repo
,
.
uri
=
{
.
type
=
uri_id
,
.
type
=
uri_id
,
.
is_int
=
true
,
.
is_int
=
true
,
},
};
};
size_t
len
=
json_object_array_length
(
json
),
i
;
size_t
len
=
json_parse_get_count
(
json
,
1
);
long
id
;
json_parse
(
json
,
1
,
__handle_fav_list_internal
,
(
void
*
)
&
uri
);
for
(
i
=
0
;
i
<
len
;
++
i
)
{
item_json
=
json_object_array_get_idx
(
json
,
i
);
if
(
item_json
==
NULL
)
{
LOG_ERROR
(
"REPO"
,
"There is no kara at index %ld in fav list %s"
,
i
,
fav
);
continue
;
}
if
(
__safe_json_get_long
(
item_json
,
"id"
,
&
id
))
{
LOG_ERROR
(
"REPO"
,
"Failed to get the id of the kara in fav list %s"
,
fav_origin
);
continue
;
}
uri
.
id
=
id
;
if
(
!
database_plt_add_uri
(
repo
->
db
,
fav
,
&
uri
))
{
LOG_ERROR
(
"REPO"
,
"Failed to add kara %ld to playlist %s"
,
id
,
fav
);
continue
;
}
}
LOG_INFO
(
"REPO"
,
"Finished importing fav list '%s' as '%s'"
,
fav_origin
,
fav
);
LOG_INFO
(
"REPO"
,
"Finished importing fav list '%s' as '%s'"
,
fav_origin
,
fav
);
json_object_put
(
json
);
free
(
json
);
}
}
static
void
*
static
void
*
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter