@@ -94,18 +94,6 @@ soundex_code(char letter)
94
94
****************************************************************************/
95
95
96
96
97
- /**************************************************************************
98
- my constants -- constants I like
99
-
100
- Probably redundant.
101
-
102
- ***************************************************************************/
103
-
104
- #define META_ERROR FALSE
105
- #define META_SUCCESS TRUE
106
- #define META_FAILURE FALSE
107
-
108
-
109
97
/* I add modifications to the traditional metaphone algorithm that you
110
98
might find in books. Define this if you want metaphone to behave
111
99
traditionally */
@@ -116,7 +104,7 @@ soundex_code(char letter)
116
104
#define TH '0'
117
105
118
106
static char Lookahead (char * word , int how_far );
119
- static int _metaphone (char * word , int max_phonemes , char * * phoned_word );
107
+ static void _metaphone (char * word , int max_phonemes , char * * phoned_word );
120
108
121
109
/* Metachar.h ... little bits about characters for metaphone */
122
110
@@ -272,7 +260,6 @@ metaphone(PG_FUNCTION_ARGS)
272
260
size_t str_i_len = strlen (str_i );
273
261
int reqlen ;
274
262
char * metaph ;
275
- int retval ;
276
263
277
264
/* return an empty string if we receive one */
278
265
if (!(str_i_len > 0 ))
@@ -296,17 +283,8 @@ metaphone(PG_FUNCTION_ARGS)
296
283
(errcode (ERRCODE_ZERO_LENGTH_CHARACTER_STRING ),
297
284
errmsg ("output cannot be empty string" )));
298
285
299
-
300
- retval = _metaphone (str_i , reqlen , & metaph );
301
- if (retval == META_SUCCESS )
302
- PG_RETURN_TEXT_P (cstring_to_text (metaph ));
303
- else
304
- {
305
- /* internal error */
306
- elog (ERROR , "metaphone: failure" );
307
- /* keep the compiler quiet */
308
- PG_RETURN_NULL ();
309
- }
286
+ _metaphone (str_i , reqlen , & metaph );
287
+ PG_RETURN_TEXT_P (cstring_to_text (metaph ));
310
288
}
311
289
312
290
@@ -362,7 +340,7 @@ Lookahead(char *word, int how_far)
362
340
#define Isbreak (c ) (!isalpha((unsigned char) (c)))
363
341
364
342
365
- static int
343
+ static void
366
344
_metaphone (char * word , /* IN */
367
345
int max_phonemes ,
368
346
char * * phoned_word ) /* OUT */
@@ -404,7 +382,7 @@ _metaphone(char *word, /* IN */
404
382
if (Curr_Letter == '\0' )
405
383
{
406
384
End_Phoned_Word ;
407
- return META_SUCCESS ; /* For testing */
385
+ return ;
408
386
}
409
387
}
410
388
@@ -721,7 +699,7 @@ _metaphone(char *word, /* IN */
721
699
722
700
End_Phoned_Word ;
723
701
724
- return ( META_SUCCESS ) ;
702
+ return ;
725
703
} /* END metaphone */
726
704
727
705
0 commit comments