[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Antiright-devel] antiright/libantiright Makefile library.h strin...
From: |
Jeffrey Bedard |
Subject: |
[Antiright-devel] antiright/libantiright Makefile library.h strin... |
Date: |
Fri, 09 Feb 2007 16:28:34 +0000 |
CVSROOT: /sources/antiright
Module name: antiright
Changes by: Jeffrey Bedard <jefbed> 07/02/09 16:28:34
Modified files:
libantiright : Makefile library.h string.c system.c util.c
Log message:
Link libantiright.a to glib. Use g_malloc instead of malloc in xmalloc.
Reindent antiright_system(). Remove commented code in string.c.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/antiright/libantiright/Makefile?cvsroot=antiright&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/antiright/libantiright/library.h?cvsroot=antiright&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/antiright/libantiright/string.c?cvsroot=antiright&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/antiright/libantiright/system.c?cvsroot=antiright&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/antiright/libantiright/util.c?cvsroot=antiright&r1=1.3&r2=1.4
Patches:
Index: Makefile
===================================================================
RCS file: /sources/antiright/antiright/libantiright/Makefile,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- Makefile 1 Feb 2007 20:45:49 -0000 1.2
+++ Makefile 9 Feb 2007 16:28:34 -0000 1.3
@@ -1,6 +1,6 @@
include ../config.mk
-CFLAGS=$(DEFS)
+CFLAGS=$(DEFS) `pkg-config --cflags glib-2.0`
all: pipe.o string.o system.o util.o
ar rcs libantiright.a pipe.o string.o system.o util.o
Index: library.h
===================================================================
RCS file: /sources/antiright/antiright/libantiright/library.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- library.h 9 Feb 2007 03:16:12 -0000 1.2
+++ library.h 9 Feb 2007 16:28:34 -0000 1.3
@@ -29,6 +29,7 @@
#include <string.h>
#include <assert.h>
#include <stdarg.h>
+#include <glib.h>
#include "pipe.h"
#include "string.h"
Index: string.c
===================================================================
RCS file: /sources/antiright/antiright/libantiright/string.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- string.c 12 Aug 2006 03:52:48 -0000 1.1
+++ string.c 9 Feb 2007 16:28:34 -0000 1.2
@@ -61,108 +61,3 @@
return(label_string);
}
-/* char* */
-/* antiright_insert_string(char *text, char *insertion, unsigned int position)
*/
-/* { */
-/* /\* Declare a counter for the output text. *\/ */
-/* unsigned int output_counter=0; */
-/* /\* Declare a counter for the initial text. *\/ */
-/* unsigned int text_counter=0; */
-/* /\* Declare a counter for the inserted text. *\/ */
-/* unsigned int insertion_counter=0; */
-/* /\* Store these lengths to avoid excessive function calls. *\/ */
-/* const unsigned int text_length=strlen(text); */
-/* const unsigned int insertion_length=strlen(insertion); */
-/* /\* Allocate enough memory to hold both strings and a null */
-/* character. *\/ */
-/* char *output=(char*)xmalloc(text_length+insertion_length+1); */
-/* /\* Put all text before insertion point into output buffer. *\/ */
-/* while(text_counter < position) */
-/* { */
-/* output[text_counter]=text[text_counter]; */
-/* text_counter++; */
-/* } */
-/* /\* Start inserting at position. *\/ */
-/* output_counter=position; */
-/* while(insertion_counter <= insertion_length) */
-/* { */
-/* output[output_counter]=insertion[insertion_counter]; */
-/* output_counter++; */
-/* insertion_counter++; */
-/* } */
-/* /\* Add the rest of the initial text to the output. *\/ */
-/* while(text_counter <= text_length) */
-/* { */
-/* output[output_counter]=text[text_counter]; */
-/* text_counter++; */
-/* output_counter++; */
-/* } */
-/* /\* Set the end of the output to be null terminated. *\/ */
-/* output[output_counter]='\0'; */
-/* /\* The function user must make sure that the returned string is */
-/* freed after use. *\/ */
-/* return(output); */
-/* } */
-
-/* char* */
-/* antiright_delete_range(char *text, unsigned int start, unsigned int end) */
-/* { */
-/* /\* Store the length of TEXT. *\/ */
-/* const unsigned int text_length=strlen(text); */
-/* /\* Create an output string large enough to hold TEXT. *\/ */
-/* char *output=(char*)xmalloc(text_length+1); */
-/* /\* Declare a counter for the text. *\/ */
-/* unsigned int text_counter=0; */
-/* /\* Declare a counter for the output. *\/ */
-/* unsigned int output_counter=0; */
-/* /\* Assign OUTPUT until START. *\/ */
-/* while(text_counter < start) */
-/* { */
-/* /\* TEXT_COUNTER could be used but it is a clearer design to use */
-/* OUTPUT_CONUTER for assignment to OUTPUT. *\/ */
-/* output[output_counter]=text[text_counter]; */
-/* output_counter++; */
-/* text_counter++; */
-/* } */
-/* /\* This sets the position at which assignment will once again start, */
-/* removing all text between start and end through such. *\/ */
-/* text_counter=end+1; */
-/* /\* Start assignment from the character after END. *\/ */
-/* while(text_counter <= text_length) */
-/* { */
-/* output[output_counter]=text[text_counter]; */
-/* text_counter++; */
-/* output_counter++; */
-/* } */
-/* /\* Set the end of the output to be null terminated. *\/ */
-/* output[output_counter]='\0'; */
-/* /\* The function user must make sure that the returned string is */
-/* freed after use. *\/ */
-/* return(output); */
-/* } */
-
-/* char* */
-/* ar_insert_txt(char* source, char* text, unsigned int position) */
-/* { */
-/* unsigned int text_length, source_length, counter, text_counter; */
-/* char* new_txt; */
-
-/* source_length=strlen(source); */
-/* text_length=strlen(text); */
-
-/* new_txt=(char*)xmalloc(source_length+text_length+1); */
-/* for(counter=0; counter<position; counter++) */
-/* { */
-/* new_txt[counter]=source[counter]; */
-/* } */
-/* for(text_counter=0; text_counter<=text_length; text_counter++) */
-/* { */
-/* new_txt[counter+text_counter]=text[text_counter]; */
-/* } */
-/* for(;counter<=(source_length+text_length); counter++) */
-/* { */
-/* new_txt[counter+text_counter]=source[counter]; */
-/* } */
-/* return(new_txt); */
-/* } */
-
Index: system.c
===================================================================
RCS file: /sources/antiright/antiright/libantiright/system.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- system.c 9 Feb 2007 03:16:12 -0000 1.2
+++ system.c 9 Feb 2007 16:28:34 -0000 1.3
@@ -29,30 +29,33 @@
if((field_string != NULL) & (strlen(field_string)>0))
{
int system_return_value=0;
- if(field_string[strlen(field_string)-1] != '&') /* Do the
- following if
- there is no
- ampersand at
- the end of
- FIELD_STRING. */
+
+ if(field_string[strlen(field_string)-1] != '&')
+ /* Do the following if there is no
+ * ampersand at the end of FIELD_STRING. */
{
char *system_string;
- /* Append an ampersand to FIELD_STRING. Place the resulting
- string in SYSTEM_STRING. */
+
+ /* Append an ampersand to FIELD_STRING. Place the
+ * resulting string in SYSTEM_STRING. */
asprintf(&system_string, "%s &", field_string);
+
/* Ensure that SYSTEM_STRING was correctly allocated. */
assert(system_string != NULL);
+
/* Execute SYSTEM_STRING. */
system_return_value=system(system_string);
+
/* Clean up. */
free(system_string);
}
- else /* The input command already includes an ampersand and will
- become a background operation. */
+ else /* The input command already includes an ampersand
+ and will become a background operation. */
{
/* Execute raw FIELD_STRING. */
system_return_value=system(field_string);
}
+
/* Return result of system call. */
return(system_return_value);
}
Index: util.c
===================================================================
RCS file: /sources/antiright/antiright/libantiright/util.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- util.c 8 Feb 2007 23:22:31 -0000 1.3
+++ util.c 9 Feb 2007 16:28:34 -0000 1.4
@@ -25,8 +25,8 @@
void *
xmalloc(size_t size)
{
- void *pointer;
- pointer=malloc(size);
+ gpointer pointer;
+ pointer=g_malloc(size);
assert(pointer); /* Ensure that the allocation was
successful. */
return(pointer);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Antiright-devel] antiright/libantiright Makefile library.h strin...,
Jeffrey Bedard <=