Move a global static declaration to main binary source files. Yes this duplicates coding lines, but this allows to load plugins without destroying the variable allocation in zm binaries.

This commit is contained in:
Emmanuel Papin 2015-01-26 20:12:20 +01:00
parent a7b912b1b5
commit 35ed0b475c
7 changed files with 14 additions and 3 deletions

View File

@ -104,8 +104,6 @@ void zmLoadConfig()
config.Assign();
}
StaticConfig staticConfig;
ConfigItem::ConfigItem( const char *p_name, const char *p_value, const char *const p_type )
{
name = new char[strlen(p_name)+1];

View File

@ -25,6 +25,8 @@
#include "zm_signal.h"
#include "zm_monitor.h"
StaticConfig staticConfig;
void Usage()
{
fprintf( stderr, "zma -m <monitor_id>\n" );

View File

@ -31,6 +31,8 @@
#include "zm_signal.h"
#include "zm_monitor.h"
StaticConfig staticConfig;
void Usage()
{
fprintf( stderr, "zmc -d <device_path> or -r <proto> -H <host> -P <port> -p <path> or -f <file_path> or -m <monitor_id>\n" );

View File

@ -38,6 +38,8 @@
#include "zmf.h"
StaticConfig staticConfig;
int OpenSocket( int monitor_id )
{
int sd = socket( AF_UNIX, SOCK_STREAM, 0);
@ -165,6 +167,7 @@ int main( int argc, char *argv[] )
char log_id_string[16];
snprintf( log_id_string, sizeof(log_id_string), "m%d", id );
StaticConfig staticConfig;
zmLoadConfig();
logInit( "zmf" );

View File

@ -26,6 +26,8 @@
#include "zm_signal.h"
#include "zm_monitor.h"
StaticConfig staticConfig;
bool ValidateAccess( User *user, int mon_id )
{
bool allowed = true;
@ -86,7 +88,7 @@ int main( int argc, const char *argv[] )
{
nph = true;
}
zmLoadConfig();
logInit( "zms" );

View File

@ -45,6 +45,8 @@
#define ZMS_DEFAULT_FPS 25.0
#define ZMS_DEFAULT_BUFFER 1000
StaticConfig staticConfig;
int main(int argc, char** argv) {
self = argv[0];
// Set initial values to the default values

View File

@ -26,6 +26,8 @@
#include "zm_monitor.h"
#include "zm_local_camera.h"
StaticConfig staticConfig;
void Usage( int status=-1 )
{
fprintf( stderr, "zmu <-d device_path> [-v] [function] [-U<username> -P<password>]\n" );