× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Thank you Scott.

-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Wednesday, October 15, 2014 10:51 AM
To: Midrange Systems Technical Discussion
Subject: Re: Syntax check a string as a valid email address

It's probably working fine because you don't use any of the subfields of
the regex_t data structure, right?

One of the dangers of sharing your code (one that I know only too well!)
is that if you make any mistakes, it's out there for the whole world to
see and point out :-)

Anyway, if you want, I do have the definitions posted here:
http://www.scottklement.com/rpg/copybooks/regex_h.rpgle.txt

-SK

On 10/15/2014 12:47 PM, Monnier, Gary wrote:
Thank you Barbara and Scott for pointing out the errors you found. The program using the regex structures has been running just fine for about 5 years.

-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Barbara Morris
Sent: Tuesday, October 14, 2014 4:32 PM
To: Midrange Systems Technical Discussion
Subject: Re: Syntax check a string as a valid email address

On 2014-10-14 15:07, Monnier, Gary wrote:


D regex_t DS qualified
D align based(prototype_only)

Unfortunately, RPG's ALIGN keyword doesn't make the data structure exactly the same as the C struct. The C data structure's length is a multiple of its alignment, which is 16 since it contains a pointer. The RPG data structure doesn't have the extra padding at the end, so it's smaller than the C struct. The regex functions expect the full length, and if the additional storage happens to be storage that your program is using, you can get unexpected results from the regex functions and/or from using your fields that happen to be where the regex functions think the end of the struct is.

You could explicitly set the length of the regex_t structure to 640.

Or if you don't want to hard-code the length ...

You could code DIM(1) to get the RPG compiler to define the size of regex_t as a multiple of its alignmen.

D reg DS likeds(regex_t) dim(1)

And then you'd pass reg(1) instead of reg when you do the call.

Or, since you're not actually using the subfields of regex_t, you could keep the calls simple by renaming your regex_t to regex_sub_t and then defining regex_t like this:

D regex_t DS qualified
D align based(prototype_only)
D reg likeds(regex_sub_t) dim(1)

--
Barbara

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.