]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
lldpcli: fix style convention to match other files
authorVincent Bernat <vincent@bernat.im>
Tue, 12 Aug 2014 17:45:14 +0000 (19:45 +0200)
committerVincent Bernat <vincent@bernat.im>
Tue, 12 Aug 2014 17:46:54 +0000 (19:46 +0200)
There are still other files around with this convention that would need
to be fixed.

src/client/text_writer.c

index 60adbb3a5977bb678ece0427df801984b1e7e302..0f0c515b83e437e08544bdf5c08bd0c040b62d35 100644 (file)
@@ -30,74 +30,80 @@ struct txt_writer_private {
        int     attrs;
 };
 
-void txt_start(struct writer * w , const char * tag, const char * descr ) {
-       struct txt_writer_private * p = w->priv;
+static void
+txt_start(struct writer *w , const char *tag, const char *descr) {
+       struct txt_writer_private *p = w->priv;
        int i = 0;
        char buf[128];
 
-       if ( p->level == 0 ) {
-               fprintf( p->fh, "%s\n", sep );
+       if (p->level == 0) {
+               fprintf(p->fh, "%s\n", sep);
        } else {
-               fprintf( p->fh, "\n" );
+               fprintf(p->fh, "\n");
        }
 
-       for( i = 1; i < p->level; i ++ ) {
-               fprintf( p->fh, "  " );
+       for (i = 1; i < p->level; i++) {
+               fprintf(p->fh, "  ");
        }
 
-       snprintf(buf,sizeof(buf),"%s:", descr);
-       fprintf( p->fh, "%-13s", buf);
+       snprintf(buf, sizeof(buf), "%s:", descr);
+       fprintf(p->fh, "%-13s", buf);
 
-       if ( p->level == 0 )
-               fprintf( p->fh, "\n%s", sep );
+       if (p->level == 0)
+               fprintf(p->fh, "\n%s", sep);
 
-       p->level ++;
+       p->level++;
        p->attrs = 0;
 }
 
-void txt_attr(struct writer * w, const char * tag, const char * descr, const char * value ) {
-       struct txt_writer_private * p = w->priv;
+static void
+txt_attr(struct writer *w, const char *tag, const char *descr, const char *value) {
+       struct txt_writer_private *p = w->priv;
 
-       if ( descr == NULL || strlen( descr ) == 0 ) {
-               fprintf( p->fh, "%s%s", (p->attrs > 0 ? ", " : " "), value );
+       if (descr == NULL || strlen(descr) == 0) {
+               fprintf(p->fh, "%s%s", (p->attrs > 0 ? ", " : " "), value);
        } else {
-               fprintf( p->fh, "%s%s: %s", (p->attrs > 0 ? ", " : " "), descr, value );
+               fprintf(p->fh, "%s%s: %s", (p->attrs > 0 ? ", " : " "), descr, value);
        }
 
-       p->attrs ++;
+       p->attrs++;
 }
 
-void txt_data(struct writer * w, const char * data) {
-       struct txt_writer_private * p = w->priv;
+static void
+txt_data(struct writer *w, const char *data) {
+       struct txt_writer_private *p = w->priv;
        fprintf( p->fh, " %s", data );
 }
 
-void txt_end(struct writer * w) {
-       struct txt_writer_private * p = w->priv;
-       p->level --;
+static void
+txt_end(struct writer *w) {
+       struct txt_writer_private *p = w->priv;
+       p->level--;
 
-       if ( p->level == 1 )
-               fprintf( p->fh, "\n%s", sep );
+       if (p->level == 1)
+               fprintf(p->fh, "\n%s", sep);
 }
 
-void txt_finish(struct writer * w) {
-       struct txt_writer_private * p = w->priv;
+static void
+txt_finish(struct writer *w) {
+       struct txt_writer_private *p = w->priv;
 
        fprintf(p->fh, "\n");
 
-       free( w->priv );
+       free(w->priv);
        w->priv = NULL;
 
-       free( w );
+       free(w);
 }
 
-struct writer * txt_init(FILE * fh) {
+struct writer*
+txt_init(FILE* fh) {
 
-       struct writer * result;
-       struct txt_writer_private * priv;
+       struct writer *result;
+       struct txt_writer_private *priv;
 
-       priv = malloc( sizeof( *priv ) );
-       if ( ! priv ) {
+       priv = malloc(sizeof(*priv));
+       if (!priv) {
                fatalx("out of memory");
                return NULL;
        }
@@ -106,8 +112,8 @@ struct writer * txt_init(FILE * fh) {
        priv->level = 0;
        priv->attrs = 0;
 
-       result = malloc( sizeof( struct writer ) );
-       if ( ! result ) {
+       result = malloc(sizeof(struct writer));
+       if (!result) {
                fatalx("out of memory");
                free(priv);
                return NULL;
@@ -122,4 +128,3 @@ struct writer * txt_init(FILE * fh) {
 
        return result;
 }
-