Reindent canonizer.c

- Untabify
- Remove trailing whitespace.
- Allman braces.
This commit is contained in:
Johan Wikman
2016-01-11 15:08:27 +02:00
parent 79fa226000
commit 20bc6a4ab7

View File

@ -7,7 +7,8 @@
#include <buffer.h>
#include <mysql.h>
static char* server_options[] = {
static char* server_options[] =
{
"MariaDB Corporation MaxScale",
"--datadir=./",
"--language=./",
@ -18,7 +19,8 @@ static char* server_options[] = {
const int num_elements = (sizeof(server_options) / sizeof(char *)) - 1;
static char* server_groups[] = {
static char* server_groups[] =
{
"embedded",
"server",
"server",
@ -27,7 +29,6 @@ static char* server_groups[] = {
int main(int argc, char** argv)
{
unsigned int psize;
GWBUF* qbuff;
char *tok;
@ -35,12 +36,14 @@ int main(int argc, char** argv)
FILE* infile;
FILE* outfile;
if(argc != 3){
if (argc != 3)
{
printf("Usage: canonizer <input file> <output file>\n");
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");
return 1;
}
@ -48,16 +51,18 @@ int main(int argc, char** argv)
infile = fopen(argv[1],"rb");
outfile = fopen(argv[2],"wb");
if(infile == NULL || outfile == NULL){
if (infile == NULL || outfile == NULL)
{
printf("Opening files failed.\n");
return 1;
}
while(!feof(infile))
while (!feof(infile))
{
fgets(readbuff,4092,infile);
psize = strlen(readbuff);
if(psize < 4092){
if (psize < 4092)
{
qbuff = gwbuf_alloc(psize + 7);
*(qbuff->sbuf->data + 0) = (unsigned char)psize;
*(qbuff->sbuf->data + 1) = (unsigned char)(psize>>8);