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(); config.Assign();
} }
StaticConfig staticConfig;
ConfigItem::ConfigItem( const char *p_name, const char *p_value, const char *const p_type ) ConfigItem::ConfigItem( const char *p_name, const char *p_value, const char *const p_type )
{ {
name = new char[strlen(p_name)+1]; name = new char[strlen(p_name)+1];

View File

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

View File

@ -31,6 +31,8 @@
#include "zm_signal.h" #include "zm_signal.h"
#include "zm_monitor.h" #include "zm_monitor.h"
StaticConfig staticConfig;
void Usage() 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" ); 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" #include "zmf.h"
StaticConfig staticConfig;
int OpenSocket( int monitor_id ) int OpenSocket( int monitor_id )
{ {
int sd = socket( AF_UNIX, SOCK_STREAM, 0); int sd = socket( AF_UNIX, SOCK_STREAM, 0);
@ -165,6 +167,7 @@ int main( int argc, char *argv[] )
char log_id_string[16]; char log_id_string[16];
snprintf( log_id_string, sizeof(log_id_string), "m%d", id ); snprintf( log_id_string, sizeof(log_id_string), "m%d", id );
StaticConfig staticConfig;
zmLoadConfig(); zmLoadConfig();
logInit( "zmf" ); logInit( "zmf" );

View File

@ -26,6 +26,8 @@
#include "zm_signal.h" #include "zm_signal.h"
#include "zm_monitor.h" #include "zm_monitor.h"
StaticConfig staticConfig;
bool ValidateAccess( User *user, int mon_id ) bool ValidateAccess( User *user, int mon_id )
{ {
bool allowed = true; bool allowed = true;

View File

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

View File

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