Remove unused xml-purge program.
authorAndriy Grytsenko <andrej@rep.kiev.ua>
Fri, 12 Sep 2014 22:41:11 +0000 (01:41 +0300)
committerAndriy Grytsenko <andrej@rep.kiev.ua>
Fri, 12 Sep 2014 22:41:11 +0000 (01:41 +0300)
src/Makefile.am
src/xml-purge.c [deleted file]

index fb15389..5ff999f 100644 (file)
@@ -49,10 +49,3 @@ lxappearance_LDADD = \
        $(DBUS_LIBS) \
        $(INTLLIBS) \
        $(NULL)
-
-
-# Little program to optimize size of xml files
-noinst_PROGRAMS=xml-purge
-xml_purge_SOURCES=xml-purge.c
-xml_purge_CFLAGS=$(GTK_CFLAGS)
-xml_purge_LDADD=$(GTK_LIBS)
diff --git a/src/xml-purge.c b/src/xml-purge.c
deleted file mode 100644 (file)
index fd0137a..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <glib.h>
-
-#define IS_BLANK(ch)   strchr(" \t\n\r", ch)
-
-static void purge_file( const char* file )
-{
-       char* buf, *pbuf;
-       int in_tag = 0, in_quote = 0;
-       FILE* fo;
-
-    if(!g_file_get_contents(file, &buf, NULL, NULL))
-        exit(1);
-
-       fo = fopen( file, "w" );
-       if( ! fo )
-               goto error;
-
-       for( pbuf = buf; *pbuf; ++pbuf )
-       {
-               if( in_tag > 0 )
-               {
-                       if( in_quote )
-                       {
-                               if( *pbuf == '\"' )
-                                       in_quote = 0;
-                       }
-                       else
-                       {
-                               if( *pbuf == '\"' )
-                                       ++in_quote;
-                               if( ! in_quote && IS_BLANK(*pbuf) )     /* skip unnecessary blanks */
-                               {
-                                       do{
-                                               ++pbuf;
-                                       }while( IS_BLANK( *pbuf ) );
-
-                                       if( *pbuf != '>' )
-                                               fputc( ' ', fo );
-                                       --pbuf;
-                                       continue;
-                               }
-                       }
-                       if( *pbuf == '>' )
-                               --in_tag;
-                       fputc( *pbuf, fo );
-               }
-               else
-               {
-                       if( *pbuf == '<' )
-                       {
-                               if( 0 == strncmp( pbuf, "<!--", 4 ) )   /* skip comments */
-                               {
-                                       pbuf = strstr( pbuf, "-->" );
-                                       if( ! pbuf )
-                                               goto error;
-                                       pbuf += 2;
-                                       continue;
-                               }
-                               ++in_tag;
-                               fputc( '<', fo );
-                       }
-                       else
-                       {
-                               char* tmp = pbuf;
-                               while( *tmp && IS_BLANK( *tmp ) && *tmp != '<' )
-                                       ++tmp;
-                               if( *tmp == '<' )       /* all cdata are blank characters */
-                                       pbuf = tmp - 1;
-                               else /* not blank, keep the cdata */
-                               {
-                                       if( tmp == pbuf )
-                                               fputc( *pbuf, fo );
-                                       else
-                                       {
-                                               fwrite( pbuf, 1, tmp - pbuf, fo );
-                                               pbuf = tmp - 1;
-                                       }
-                               }
-                       }
-               }
-       }
-
-       fclose( fo );
-
-error:
-       free( buf );
-}
-
-int main( int argc, char** argv )
-{
-       int i;
-       if( argc < 2 )
-               return 1;
-
-       for( i = 1; i < argc; ++i )
-               purge_file( argv[ i] );
-
-       return 0;
-}