[ace-users] regcomp, regexec, regfree Problems on Linux

jhoffert at dre.vanderbilt.edu jhoffert at dre.vanderbilt.edu
Thu Sep 27 07:42:40 CDT 2007


Hi, David.

I think you're right.

Thanks!

-Joe

>> -----Message d'origine-----
>> De : ace-users-bounces at cse.wustl.edu
>> [mailto:ace-users-bounces at cse.wustl.edu] De la part de
>> jhoffert at dre.vanderbilt.edu Envoyé : jeudi 27 septembre 2007 13:39 À :
>> ace-users at cse.wustl.edu Objet : Re: [ace-users] regcomp, regexec,
>> regfree Problems on Linux
>>
>> Hi, all.
>>
>> I modified the program that I sent out yesterday slightly so that the
>> problems go away. However, I don't understand why my changes make a
>> difference.
>>
>> I made the regex_t data member public, removed the call to regfree in
>> the destructor, and called
>> ::regfree(&matcher.regexp_) in main () right before the return
>> statement.
>>
>> Does anyone have any idea what the problem is?
>
>
> May be yes,
>
> You can see regex_t as a  pointer that must be delete only once
>
> We you pass "matcher" to remove_copy_if, it copy a local one.
> So two instance of RegexMatcher share the same regex_t pinter
>
> When remove_copy_if finish, the local RegexMatcher call is destructor that
> destroy is regexp_t (the same that is share  by the one in the main)
>
> When you go out of the main scope, your "matcher" call the destructor and
> regfree on the same regex_t value... So it core.
>
>
> Hope it clear.
>
>>
>> Thanks.
> Ce message et ses pièces jointes (le "message") est destiné à l'usage
> exclusif de son destinataire.
> Si vous recevez ce message par erreur, merci d'en aviser immédiatement
> l'expéditeur  et de le détruire ensuite. Le présent message  pouvant
> être altéré à notre insu,  CALYON Crédit Agricole CIB
> ne peut pas être engagé par son contenu. Tous droits réservés.
>
> This message and/or any  attachments (the "message") is intended for
> the sole use of its addressee.
> If you are not the addressee, please immediately notify the sender and
> then destroy the message.  As this message and/or any attachments may
> have been altered without our knowledge,  its content  is not legally
> binding on CALYON Crédit Agricole CIB. All rights reserved.
> _______________________________________________
> ace-users mailing list
> ace-users at mail.cse.wustl.edu
> http://mail.cse.wustl.edu/mailman/listinfo/ace-users
>



More information about the Ace-users mailing list