Fixed bug on memory allocation for string types and fixed linker problem on example main program

This commit is contained in:
Jan Lindström
2013-07-02 07:09:44 +03:00
parent b51232c518
commit 471b3cbaf2
8 changed files with 37 additions and 19 deletions

View File

@ -23,7 +23,7 @@ CMAKE_BACKWARDS_COMPATIBILITY:STRING=2.4
//Choose the type of build, options are: None(CMAKE_CXX_FLAGS or
// CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.
CMAKE_BUILD_TYPE:STRING=
CMAKE_BUILD_TYPE:STRING=Debug
//Enable/Disable color output during build.
CMAKE_COLOR_MAKEFILE:BOOL=ON

View File

@ -2,7 +2,7 @@
# Generated by "Unix Makefiles" Generator, CMake Version 2.8
# compile C with /usr/bin/gcc
C_FLAGS = -I/usr/local/include -I/home/jan/skysql/skygateway/skygateway/utils
C_FLAGS = -g -I/usr/local/include -I/home/jan/skysql/skygateway/skygateway/utils
C_DEFINES =

View File

@ -1 +1 @@
/usr/bin/gcc CMakeFiles/Example.dir/Example.c.o -o Example -rdynamic -Wl,-Bstatic -ltable_replication_consistency -Wl,-Bdynamic -lreplication -lboost_system -lpthread
/usr/bin/gcc -g CMakeFiles/Example.dir/Example.c.o -o Example -rdynamic -Wl,-Bstatic -ltable_replication_consistency -Wl,-Bdynamic -lreplication -lboost_system -lpthread

View File

@ -3,6 +3,7 @@
#include <stdlib.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
int main(int argc, char** argv)
{
@ -24,7 +25,8 @@ int main(int argc, char** argv)
if ( strncmp("mysql://", uri, 8) == 0) {
mrl[i].server_url = uri;
mrl[k].server_url = malloc(strlen(uri)+1);
strcpy(mrl[k].server_url, uri);
k++;
if (argc == 1) {

View File

@ -12,7 +12,7 @@ IF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
STRING(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
ELSE(BUILD_TYPE)
SET(CMAKE_INSTALL_CONFIG_NAME "")
SET(CMAKE_INSTALL_CONFIG_NAME "Debug")
ENDIF(BUILD_TYPE)
MESSAGE(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
ENDIF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)