summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--zwgc/character_class.c10
-rw-r--r--zwgc/character_class.h2
-rw-r--r--zwgc/formatter.c18
-rw-r--r--zwgc/text_operations.c16
4 files changed, 26 insertions, 20 deletions
diff --git a/zwgc/character_class.c b/zwgc/character_class.c
index 79a6552..653e0e8 100644
--- a/zwgc/character_class.c
+++ b/zwgc/character_class.c
@@ -20,9 +20,15 @@ static char rcsid_character_class_c[] = "$Header$";
#include "character_class.h"
+/*
+ * It may look like we are passing the cache by value, but since it's
+ * really an array we are passing by reference. C strikes again....
+ */
+
static character_class cache;
-character_class *string_to_character_class(str)
+/* character_class */
+char * string_to_character_class(str)
string str;
{
int i;
@@ -32,5 +38,5 @@ character_class *string_to_character_class(str)
for (i=0; i<strlen(str); i++)
cache[str[i]] = 1;
- return(&cache);
+ return(cache);
}
diff --git a/zwgc/character_class.h b/zwgc/character_class.h
index 4fe3c36..7786995 100644
--- a/zwgc/character_class.h
+++ b/zwgc/character_class.h
@@ -25,6 +25,6 @@
typedef char character_class[NUMBER_OF_CHARACTERS];
-extern character_class *string_to_character_class();
+extern /* character_class */ char * string_to_character_class();
#endif
diff --git a/zwgc/formatter.c b/zwgc/formatter.c
index f62a43d..47bd7d4 100644
--- a/zwgc/formatter.c
+++ b/zwgc/formatter.c
@@ -179,10 +179,10 @@ string verbatim(str)
if (strlen(str) == pure_text_length(str,0)) {
/* No environments, so consider the fast-and-easy methods */
- if (not_contains(str,&allbracket_set))
+ if (not_contains(str,allbracket_set))
return(string_Copy(str));
- if (not_contains(str,&abracket_set)) {
+ if (not_contains(str,abracket_set)) {
temp=(char *) malloc((len=strlen(str))+4);
temp[0]='@';
temp[1]='<';
@@ -191,7 +191,7 @@ string verbatim(str)
temp[len+3]='\0';
return(temp);
}
- if (not_contains(str,&sbracket_set)) {
+ if (not_contains(str,sbracket_set)) {
temp=(char *) malloc((len=strlen(str))+4);
temp[0]='@';
temp[1]='[';
@@ -200,7 +200,7 @@ string verbatim(str)
temp[len+3]='\0';
return(temp);
}
- if (not_contains(str,&cbracket_set)) {
+ if (not_contains(str,cbracket_set)) {
temp=(char *) malloc((len=strlen(str))+4);
temp[0]='@';
temp[1]='{';
@@ -209,7 +209,7 @@ string verbatim(str)
temp[len+3]='\0';
return(temp);
}
- if (not_contains(str,&paren_set)) {
+ if (not_contains(str,paren_set)) {
temp=(char *) malloc((len=strlen(str))+4);
temp[0]='@';
temp[1]='(';
@@ -220,14 +220,14 @@ string verbatim(str)
}
}
- temp=lbreak(&str,&allmaskable_set);
+ temp=lbreak(&str,allmaskable_set);
while(*str) {
bracketnum=(int) (index(brackets,str[0])-brackets);
temp=string_Concat2(temp,openbracket[bracketnum]);
temp=string_Concat2(temp,temp2=lany(&str," "));
free(temp2);
temp=string_Concat2(temp,closebracket[bracketnum]);
- temp=string_Concat2(temp,temp2=lbreak(&str,&allmaskable_set));
+ temp=string_Concat2(temp,temp2=lbreak(&str,allmaskable_set));
free(temp2);
}
free(str); /* str is "" at this point, anyway */
@@ -381,9 +381,9 @@ string protect(str)
int not_contains(str, set)
string str;
- character_class *set;
+ character_class set;
{
- while (*str && ! (*set)[*str]) str++;
+ while (*str && ! set[*str]) str++;
return (! *str);
}
diff --git a/zwgc/text_operations.c b/zwgc/text_operations.c
index 69db241..ba1821a 100644
--- a/zwgc/text_operations.c
+++ b/zwgc/text_operations.c
@@ -41,12 +41,12 @@ string lany(text_ptr, str)
string lbreak(text_ptr, set)
string *text_ptr;
- character_class *set;
+ character_class set;
{
string result, whats_left;
char *p = *text_ptr;
- while (*p && !(*set)[*p]) p++;
+ while (*p && !set[*p]) p++;
result = string_CreateFromData(*text_ptr, p - *text_ptr);
whats_left = string_Copy(p);
@@ -58,12 +58,12 @@ string lbreak(text_ptr, set)
string lspan(text_ptr, set)
string *text_ptr;
- character_class *set;
+ character_class set;
{
string result, whats_left;
char *p = *text_ptr;
- while (*p && (*set)[*p]) p++;
+ while (*p && set[*p]) p++;
result = string_CreateFromData(*text_ptr, p - *text_ptr);
whats_left = string_Copy(p);
@@ -93,13 +93,13 @@ string rany(text_ptr, str)
string rbreak(text_ptr, set)
string *text_ptr;
- character_class *set;
+ character_class set;
{
string result, whats_left;
string text = *text_ptr;
char *p = text + strlen(text);
- while (text<p && !(*set)[p[-1]]) p--;
+ while (text<p && !set[p[-1]]) p--;
result = string_Copy(p);
whats_left = string_CreateFromData(text, p - text);
@@ -111,13 +111,13 @@ string rbreak(text_ptr, set)
string rspan(text_ptr, set)
string *text_ptr;
- character_class *set;
+ character_class set;
{
string result, whats_left;
string text = *text_ptr;
char *p = text + strlen(text);
- while (text<p && (*set)[p[-1]]) p--;
+ while (text<p && set[p[-1]]) p--;
result = string_Copy(p);
whats_left = string_CreateFromData(text, p - text);