Skip to content

Commit fee46cb

Browse files
author
raw
committed
added files to gitignore
moved non-mysql dependent functions from preg.c and ghmysql.c into pregUtils.c
1 parent 2ef9815 commit fee46cb

File tree

14 files changed

+347
-196
lines changed

14 files changed

+347
-196
lines changed

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,20 @@ lib_mysqludf_preg_la-lib_mysqludf_preg_rlike.lo
3333
lib_mysqludf_preg_la-lib_mysqludf_preg_rlike.o
3434
lib_mysqludf_preg_la-preg.lo
3535
lib_mysqludf_preg_la-preg.o
36+
lib_mysqludf_preg_la-ghfcns.lo
37+
lib_mysqludf_preg_la-ghfcns.o
38+
lib_mysqludf_preg_la-pregUtils.lo
39+
lib_mysqludf_preg_la-pregUtils.o
40+
lib_mysqludf_preg_la-preg_utils.lo
41+
lib_mysqludf_preg_la-preg_utils.o
42+
test/lib_mysqludf_preg_capture.log
43+
test/lib_mysqludf_preg_check.log
44+
test/lib_mysqludf_preg_info.log
45+
test/lib_mysqludf_preg_position.log
46+
test/lib_mysqludf_preg_replace.log
47+
test/lib_mysqludf_preg_rlike.log
3648
libtool
3749
stamp-h1
3850
test/Makefile
51+
lib_mysqludf_preg-*.tar.gz
3952

Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ lib_LTLIBRARIES = lib_mysqludf_preg.la
77

88
CFILES= \
99
preg.c \
10+
preg_utils.c \
1011
ghmysql.c \
1112
ghfcns.c \
1213
from_php.c \
@@ -21,6 +22,7 @@ HFILES = \
2122
preg.h \
2223
ghmysql.h \
2324
ghfcns.h \
25+
preg_utils.h \
2426
from_php.h
2527

2628
lib_mysqludf_preg_la_SOURCES = \

Makefile.in

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ am__installdirs = "$(DESTDIR)$(libdir)"
105105
LTLIBRARIES = $(lib_LTLIBRARIES)
106106
lib_mysqludf_preg_la_LIBADD =
107107
am__objects_1 = lib_mysqludf_preg_la-preg.lo \
108+
lib_mysqludf_preg_la-preg_utils.lo \
108109
lib_mysqludf_preg_la-ghmysql.lo lib_mysqludf_preg_la-ghfcns.lo \
109110
lib_mysqludf_preg_la-from_php.lo \
110111
lib_mysqludf_preg_la-lib_mysqludf_preg_capture.lo \
@@ -381,6 +382,7 @@ AUTOMAKE_OPTIONS = foreign
381382
lib_LTLIBRARIES = lib_mysqludf_preg.la
382383
CFILES = \
383384
preg.c \
385+
preg_utils.c \
384386
ghmysql.c \
385387
ghfcns.c \
386388
from_php.c \
@@ -395,6 +397,7 @@ HFILES = \
395397
preg.h \
396398
ghmysql.h \
397399
ghfcns.h \
400+
preg_utils.h \
398401
from_php.h
399402

400403
lib_mysqludf_preg_la_SOURCES = \
@@ -516,6 +519,7 @@ distclean-compile:
516519
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib_mysqludf_preg_la-lib_mysqludf_preg_replace.Plo@am__quote@
517520
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib_mysqludf_preg_la-lib_mysqludf_preg_rlike.Plo@am__quote@
518521
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib_mysqludf_preg_la-preg.Plo@am__quote@
522+
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib_mysqludf_preg_la-preg_utils.Plo@am__quote@
519523

520524
.c.o:
521525
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -545,6 +549,13 @@ lib_mysqludf_preg_la-preg.lo: preg.c
545549
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
546550
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_mysqludf_preg_la_CFLAGS) $(CFLAGS) -c -o lib_mysqludf_preg_la-preg.lo `test -f 'preg.c' || echo '$(srcdir)/'`preg.c
547551

552+
lib_mysqludf_preg_la-preg_utils.lo: preg_utils.c
553+
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_mysqludf_preg_la_CFLAGS) $(CFLAGS) -MT lib_mysqludf_preg_la-preg_utils.lo -MD -MP -MF $(DEPDIR)/lib_mysqludf_preg_la-preg_utils.Tpo -c -o lib_mysqludf_preg_la-preg_utils.lo `test -f 'preg_utils.c' || echo '$(srcdir)/'`preg_utils.c
554+
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/lib_mysqludf_preg_la-preg_utils.Tpo $(DEPDIR)/lib_mysqludf_preg_la-preg_utils.Plo
555+
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='preg_utils.c' object='lib_mysqludf_preg_la-preg_utils.lo' libtool=yes @AMDEPBACKSLASH@
556+
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
557+
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_mysqludf_preg_la_CFLAGS) $(CFLAGS) -c -o lib_mysqludf_preg_la-preg_utils.lo `test -f 'preg_utils.c' || echo '$(srcdir)/'`preg_utils.c
558+
548559
lib_mysqludf_preg_la-ghmysql.lo: ghmysql.c
549560
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_mysqludf_preg_la_CFLAGS) $(CFLAGS) -MT lib_mysqludf_preg_la-ghmysql.lo -MD -MP -MF $(DEPDIR)/lib_mysqludf_preg_la-ghmysql.Tpo -c -o lib_mysqludf_preg_la-ghmysql.lo `test -f 'ghmysql.c' || echo '$(srcdir)/'`ghmysql.c
550561
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/lib_mysqludf_preg_la-ghmysql.Tpo $(DEPDIR)/lib_mysqludf_preg_la-ghmysql.Plo

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ The short instructions are:
7676
Getting libmysql_udf_preg
7777
===========================
7878
Please visit the github repository at: https://github.com/mysqludf/lib_mysqludf_preg
79-
The latest released code is available on the master branch. Please help test by trying out the latest dev and rc branches too.
79+
The latest released code is available on the master branch. Please help test by trying out the latest dev and rc releases.
8080

8181

8282
Reporting Bugs & Feedback

from_php.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ POSSIBILITY OF SUCH DAMAGE.
4747
*/
4848

4949
/*
50-
* This file was modified my Rich Waters <raw@goodhumans.com> for use
51-
* with a mysql udf.
50+
* This file was modified by Rich Waters <raw@goodhumans.net> for use
51+
* with a mysql udf and elsewhere.
5252
*/
5353

5454
#include "pcre.h"
@@ -61,6 +61,7 @@ POSSIBILITY OF SUCH DAMAGE.
6161
//#include "preg.h"
6262

6363
#include "ghfcns.h"
64+
#include "preg_utils.h"
6465

6566
#undef HAVE_SETLOCALE // R.A.W
6667

ghfcns.c

Lines changed: 59 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,39 @@
11
/*
2-
* ghfcns.c
3-
* eMailGanizer
2+
* Copyright (C) 2007-2013 Rich Waters <[email protected]>
43
*
5-
* Created by Rich Waters on 9/3/10.
6-
* Copyright 2010 GoodHumans. All rights reserved.
4+
* This file is part of lib_mysqludf_preg.
75
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in
14+
* all copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
* THE SOFTWARE.
823
*/
924

25+
/** @file ghfcns.c
26+
*
27+
* @brief Provides some utility functions that are independent of mysql.
28+
*
29+
*/
30+
31+
1032
#include <stdlib.h>
1133
#include <stdio.h>
1234
#include <string.h>
35+
#include <time.h>
36+
#include <stdarg.h>
1337

1438
#include "ghfcns.h"
1539

@@ -47,3 +71,34 @@ char *ghstrndup( char *s , size_t l )
4771
}
4872

4973

74+
/**
75+
* @fn void ghlogprintf( fmt, ... )
76+
*
77+
* @brief log an error message to stderr in MySQL format
78+
*
79+
* @param fmt - a format string as per sprintf()
80+
* @param ... - varargs as per sprintf()
81+
*
82+
* @return void
83+
*
84+
* @details - This function writes the specified error message
85+
* to stderr prefixed by the current time in the same format
86+
* used by MySQL
87+
*/
88+
void ghlogprintf(char *fmt, ...) {
89+
va_list vargs;
90+
char buf[18];
91+
time_t now;
92+
struct tm time_val;
93+
94+
memset(&buf, 0, sizeof(buf));
95+
96+
now = time(NULL);
97+
localtime_r(&now, &time_val);
98+
strftime(&buf[0], sizeof(buf), "%y%m%d %H:%M:%S ", &time_val);
99+
fprintf(stderr, "%s", buf);
100+
101+
va_start(vargs, fmt);
102+
vfprintf(stderr, fmt, vargs);
103+
va_end(vargs);
104+
}

ghfcns.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@
88
*/
99

1010
char *ghstrndup( char *s , size_t l );
11+
void ghlogprintf(char *fmt, ...);
1112

ghmysql.c

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -119,34 +119,3 @@ int ghargIsNullConstant(UDF_ARGS *args, int argNum)
119119
return 0 ;
120120
}
121121

122-
/**
123-
* @fn void ghlogprintf( fmt, ... )
124-
*
125-
* @brief log an error message to stderr in MySQL format
126-
*
127-
* @param fmt - a format string as per sprintf()
128-
* @param ... - varargs as per sprintf()
129-
*
130-
* @return void
131-
*
132-
* @details - This function writes the specified error message
133-
* to stderr prefixed by the current time in the same format
134-
* used by MySQL
135-
*/
136-
void ghlogprintf(char *fmt, ...) {
137-
va_list vargs;
138-
char buf[18];
139-
time_t now;
140-
struct tm time_val;
141-
142-
memset(&buf, 0, sizeof(buf));
143-
144-
now = time(NULL);
145-
localtime_r(&now, &time_val);
146-
strftime(&buf[0], sizeof(buf), "%y%m%d %H:%M:%S ", &time_val);
147-
fprintf(stderr, buf);
148-
149-
va_start(vargs, fmt);
150-
vfprintf(stderr, fmt, vargs);
151-
va_end(vargs);
152-
}

ghmysql.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
/*
23
* Copyright (C) 2007-2013 Rich Waters <[email protected]>
34
*
@@ -78,6 +79,5 @@ char *ghargdup( UDF_ARGS *args,int i ) ;
7879
char *ghargdups( UDF_ARGS *args,int i , unsigned long *l) ;
7980
//char *ghstrndup( char *s , int l );
8081
int ghargIsNullConstant(UDF_ARGS *args, int argNum);
81-
void ghlogprintf(char *fmt, ...);
8282

8383
#endif

0 commit comments

Comments
 (0)