Browse Source

Habilitar flag para habilitar DEBUG e SANITIZE na compilação do amid.

Para ter o binário com DEBUG: 'make DEBUG=1' Isso irá ativar -DDEBUG -g -pg
Para ter o sanitize: 'make SANITIZE=1' Isso irá ativar -fsanitize=address
dev
Rodgger Bruno 3 months ago
parent
commit
aa3cefc40b
  1. 11
      Makefile
  2. 2
      src/parse_events.h

11
Makefile

@ -25,7 +25,7 @@ DIR_OBJ=build/
DIR_SRC=src/
CFLAGS= -I $(DIR_SRC) -Wall -g -DDEBUG $(shell mariadb_config --cflags --include ) -pg
CFLAGS= -I $(DIR_SRC) -Wall $(shell mariadb_config --cflags --include )
LIBS= $(shell mariadb_config --libs ) -lpthread -lami_c -lsystemd
OBJ = \
@ -67,10 +67,17 @@ build/dial_db.o \
build/transfer.o \
build/transfer_db.o
ifeq ($(SANITIZE), 1)
CFLAGS += -fsanitize=address
endif
ifeq ($(DEBUG), 1)
CFLAGS += -DDEBUG -g -pg
endif
$(PROGRAM_NAME): $(OBJ)
$(CC) -o $@ $^ $(LIBS)
$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
$(DIR_OBJ)%.o: $(DIR_SRC)%.c
$(CC) -c -o $@ $< $(CFLAGS)

2
src/parse_events.h

@ -30,7 +30,7 @@
* Formato: ("NomeDoArgumentoNoAMI", variavel) */
#define GET_EVENT_ARGUMENT_VALUE(argument, value) \
value = ami_get_value(smanager->ami, event->args, argument); \
if(!value){ _DEBUG("Erro na função %s na obtenção do valor do argumento "argument" do evento", __func__); goto fail;}
if(!value){ FAIL("Erro na função %s na obtenção do valor do argumento "argument" do evento", __func__); goto fail;}
/* Obtém o valor inteiro do "argumento" em um evento.
* Requer as estruturas s_manager e EVENT

Loading…
Cancel
Save