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
8a1abe39
Vérifiée
Valider
8a1abe39
rédigé
12 mai 2020
par
Kubat
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
Corrections in reg_pick
parent
0739a4ff
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion
!92
Mod
Modifications
2
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
2 fichiers modifiés
src/config.c
+7
-15
7 ajouts, 15 suppressions
src/config.c
src/reg.c
+30
-31
30 ajouts, 31 suppressions
src/reg.c
avec
37 ajouts
et
46 suppressions
src/config.c
+
7
−
15
Voir le fichier @
8a1abe39
...
@@ -4,6 +4,8 @@
...
@@ -4,6 +4,8 @@
#include
<lektor/config.h>
#include
<lektor/config.h>
#include
<lektor/database.h>
#include
<lektor/database.h>
#include
<lektor/net.h>
#include
<lektor/net.h>
#include
<lektor/reg.h>
#include
<stdlib.h>
#include
<stdlib.h>
#include
<errno.h>
#include
<errno.h>
#include
<string.h>
#include
<string.h>
...
@@ -121,23 +123,13 @@ load_so(const char *const mod_path, const char *const mod_init, void *mod, struc
...
@@ -121,23 +123,13 @@ load_so(const char *const mod_path, const char *const mod_init, void *mod, struc
Uppon successfull completion, the function shall return 0, and return
Uppon successfull completion, the function shall return 0, and return
a non zero value if something bad happened. */
a non zero value if something bad happened. */
int
(
*
module_set_function
)(
void
*
const
,
struct
lkt_state
*
,
void
*
const
);
int
(
*
module_set_function
)(
void
*
const
,
struct
lkt_state
*
,
void
*
const
);
char
*
error
;
void
*
handle
=
NULL
;
void
*
handle
=
dlopen
(
mod_path
,
RTLD_NOW
);
*
(
void
**
)
(
&
module_set_function
)
=
reg_pick
(
mod_path
,
&
handle
,
mod_init
);
if
(
NULL
==
handle
)
{
LOG_ERROR
(
"libdl error in dlopen on file '%s': %s"
,
mod_path
,
dlerror
());
return
1
;
}
dlerror
();
*
(
void
**
)
(
&
module_set_function
)
=
dlsym
(
handle
,
mod_init
);
if
((
error
=
dlerror
())
!=
NULL
)
{
LOG_ERROR
(
"libdl error in dlsym on file '%s': %s
\n
"
,
mod_path
,
error
);
return
1
;
}
if
(
module_set_function
)
return
!
module_set_function
(
mod
,
srv
,
handle
);
return
!
module_set_function
(
mod
,
srv
,
handle
);
else
return
1
;
}
}
inline
int
inline
int
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
src/reg.c
+
30
−
31
Voir le fichier @
8a1abe39
...
@@ -12,13 +12,15 @@ struct module_reg *reg;
...
@@ -12,13 +12,15 @@ struct module_reg *reg;
void
*
void
*
reg_pick
(
const
char
*
file
,
void
**
handle
,
const
char
*
symbol
)
reg_pick
(
const
char
*
file
,
void
**
handle
,
const
char
*
symbol
)
{
{
int
i
;
if
(
!
symbol
)
if
(
!
symbol
)
return
NULL
;
return
NULL
;
/* Use the register instead of dlfcn? */
if
(
!
file
||
STR_MATCH
(
file
,
"STATIC"
)
||
handle
==
NULL
)
goto
use_reg
;
/* Use dlsym */
/* Use dlsym */
if
(
handle
)
{
if
(
!
file
)
return
NULL
;
char
*
error
;
char
*
error
;
*
handle
=
dlopen
(
file
,
RTLD_NOW
);
*
handle
=
dlopen
(
file
,
RTLD_NOW
);
...
@@ -28,7 +30,7 @@ reg_pick(const char *file, void **handle, const char *symbol)
...
@@ -28,7 +30,7 @@ reg_pick(const char *file, void **handle, const char *symbol)
}
}
dlerror
();
dlerror
();
void
*
sym
=
dlsym
(
handle
,
symbol
);
void
*
sym
=
dlsym
(
*
handle
,
symbol
);
if
((
error
=
dlerror
())
!=
NULL
)
{
if
((
error
=
dlerror
())
!=
NULL
)
{
LOG_ERROR
(
"libdl error in dlsym on file '%s': %s
\n
"
,
file
,
error
);
LOG_ERROR
(
"libdl error in dlsym on file '%s': %s
\n
"
,
file
,
error
);
...
@@ -36,11 +38,9 @@ reg_pick(const char *file, void **handle, const char *symbol)
...
@@ -36,11 +38,9 @@ reg_pick(const char *file, void **handle, const char *symbol)
}
}
return
sym
;
return
sym
;
}
/* Read the reg */
/* Read the reg */
else
{
use_reg:
int
i
;
for
(
i
=
0
;
reg
[
i
].
name
&&
reg
[
i
].
func
&&
!
STR_MATCH
(
reg
[
i
].
name
,
symbol
);
++
i
)
for
(
i
=
0
;
reg
[
i
].
name
&&
reg
[
i
].
func
&&
!
STR_MATCH
(
reg
[
i
].
name
,
symbol
);
++
i
)
continue
;
continue
;
...
@@ -49,7 +49,6 @@ reg_pick(const char *file, void **handle, const char *symbol)
...
@@ -49,7 +49,6 @@ reg_pick(const char *file, void **handle, const char *symbol)
else
else
return
NULL
;
return
NULL
;
}
}
}
void
void
reg_set
(
struct
module_reg
*
_reg
)
reg_set
(
struct
module_reg
*
_reg
)
...
...
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