Code cleanup

This commit is contained in:
Pierre Pronchery 2014-05-07 02:15:53 +02:00
parent a01c33c6b3
commit 484b59a68e
2 changed files with 13 additions and 11 deletions

View File

@ -1,5 +1,5 @@
/* $Id$ */ /* $Id$ */
/* Copyright (c) 2008-2012 Pierre Pronchery <khorben@defora.org> */ /* Copyright (c) 2008-2014 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS System libSystem */ /* This file is part of DeforaOS System libSystem */
/* This program is free software: you can redistribute it and/or modify /* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by * it under the terms of the GNU Lesser General Public License as published by
@ -18,19 +18,21 @@
#ifndef LIBSYSTEM_PLUGIN_H #ifndef LIBSYSTEM_PLUGIN_H
# define LIBSYSTEM_PLUGIN_H # define LIBSYSTEM_PLUGIN_H
# include "string.h"
/* Plugin */ /* Plugin */
typedef void Plugin; typedef void Plugin;
/* functions */ /* functions */
Plugin * plugin_new(char const * libdir, char const * package, Plugin * plugin_new(String const * libdir, String const * package,
char const * type, char const * name); String const * type, String const * name);
Plugin * plugin_new_self(void); Plugin * plugin_new_self(void);
void plugin_delete(Plugin * plugin); void plugin_delete(Plugin * plugin);
/* useful */ /* useful */
void * plugin_lookup(Plugin * plugin, char const * symbol); void * plugin_lookup(Plugin * plugin, String const * symbol);
#endif /* !LIBSYSTEM_PLUGIN_H */ #endif /* !LIBSYSTEM_PLUGIN_H */

View File

@ -1,5 +1,5 @@
/* $Id$ */ /* $Id$ */
/* Copyright (c) 2008-2013 Pierre Pronchery <khorben@defora.org> */ /* Copyright (c) 2008-2014 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS System libSystem */ /* This file is part of DeforaOS System libSystem */
/* This program is free software: you can redistribute it and/or modify /* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by * it under the terms of the GNU Lesser General Public License as published by
@ -41,11 +41,11 @@
/* prototypes */ /* prototypes */
static Plugin * _plugin_open(char const * filename); static Plugin * _plugin_open(String const * filename);
/* functions */ /* functions */
static Plugin * _plugin_open(char const * filename) static Plugin * _plugin_open(String const * filename)
{ {
#ifdef __WIN32__ #ifdef __WIN32__
if(filename == NULL) if(filename == NULL)
@ -64,12 +64,12 @@ static Plugin * _plugin_open(char const * filename)
/* public */ /* public */
/* functions */ /* functions */
/* plugin_new */ /* plugin_new */
Plugin * plugin_new(char const * libdir, char const * package, Plugin * plugin_new(String const * libdir, String const * package,
char const * type, char const * name) String const * type, String const * name)
{ {
Plugin * plugin; Plugin * plugin;
size_t len; size_t len;
char * filename; String * filename;
char const ext[] = PLUGIN_EXTENSION; char const ext[] = PLUGIN_EXTENSION;
len = strlen(libdir) + 1 + strlen(package) + 1 + strlen(type) + 1 len = strlen(libdir) + 1 + strlen(package) + 1 + strlen(type) + 1
@ -107,7 +107,7 @@ void plugin_delete(Plugin * plugin)
/* useful */ /* useful */
/* plugin_lookup */ /* plugin_lookup */
void * plugin_lookup(Plugin * plugin, char const * symbol) void * plugin_lookup(Plugin * plugin, String const * symbol)
{ {
#ifdef __WIN32__ #ifdef __WIN32__
return GetProcAddress(plugin, symbol); return GetProcAddress(plugin, symbol);