Reindent canonizer.c
- Untabify - Remove trailing whitespace. - Allman braces.
This commit is contained in:
@ -7,7 +7,8 @@
|
|||||||
#include <buffer.h>
|
#include <buffer.h>
|
||||||
#include <mysql.h>
|
#include <mysql.h>
|
||||||
|
|
||||||
static char* server_options[] = {
|
static char* server_options[] =
|
||||||
|
{
|
||||||
"MariaDB Corporation MaxScale",
|
"MariaDB Corporation MaxScale",
|
||||||
"--datadir=./",
|
"--datadir=./",
|
||||||
"--language=./",
|
"--language=./",
|
||||||
@ -18,7 +19,8 @@ static char* server_options[] = {
|
|||||||
|
|
||||||
const int num_elements = (sizeof(server_options) / sizeof(char *)) - 1;
|
const int num_elements = (sizeof(server_options) / sizeof(char *)) - 1;
|
||||||
|
|
||||||
static char* server_groups[] = {
|
static char* server_groups[] =
|
||||||
|
{
|
||||||
"embedded",
|
"embedded",
|
||||||
"server",
|
"server",
|
||||||
"server",
|
"server",
|
||||||
@ -27,7 +29,6 @@ static char* server_groups[] = {
|
|||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
|
||||||
unsigned int psize;
|
unsigned int psize;
|
||||||
GWBUF* qbuff;
|
GWBUF* qbuff;
|
||||||
char *tok;
|
char *tok;
|
||||||
@ -35,12 +36,14 @@ int main(int argc, char** argv)
|
|||||||
FILE* infile;
|
FILE* infile;
|
||||||
FILE* outfile;
|
FILE* outfile;
|
||||||
|
|
||||||
if(argc != 3){
|
if (argc != 3)
|
||||||
|
{
|
||||||
printf("Usage: canonizer <input file> <output file>\n");
|
printf("Usage: canonizer <input file> <output file>\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mysql_library_init(num_elements, server_options, server_groups)){
|
if (mysql_library_init(num_elements, server_options, server_groups))
|
||||||
|
{
|
||||||
printf("Embedded server init failed.\n");
|
printf("Embedded server init failed.\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -48,16 +51,18 @@ int main(int argc, char** argv)
|
|||||||
infile = fopen(argv[1],"rb");
|
infile = fopen(argv[1],"rb");
|
||||||
outfile = fopen(argv[2],"wb");
|
outfile = fopen(argv[2],"wb");
|
||||||
|
|
||||||
if(infile == NULL || outfile == NULL){
|
if (infile == NULL || outfile == NULL)
|
||||||
|
{
|
||||||
printf("Opening files failed.\n");
|
printf("Opening files failed.\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while(!feof(infile))
|
while (!feof(infile))
|
||||||
{
|
{
|
||||||
fgets(readbuff,4092,infile);
|
fgets(readbuff,4092,infile);
|
||||||
psize = strlen(readbuff);
|
psize = strlen(readbuff);
|
||||||
if(psize < 4092){
|
if (psize < 4092)
|
||||||
|
{
|
||||||
qbuff = gwbuf_alloc(psize + 7);
|
qbuff = gwbuf_alloc(psize + 7);
|
||||||
*(qbuff->sbuf->data + 0) = (unsigned char)psize;
|
*(qbuff->sbuf->data + 0) = (unsigned char)psize;
|
||||||
*(qbuff->sbuf->data + 1) = (unsigned char)(psize>>8);
|
*(qbuff->sbuf->data + 1) = (unsigned char)(psize>>8);
|
||||||
|
|||||||
Reference in New Issue
Block a user