mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
String::release and String::reset methods
Rename reassociate to reset and create an inverse method release. Method names are chosen to match std::unique_ptr methods.
This commit is contained in:
@ -257,9 +257,9 @@ public:
|
||||
bool set(ulonglong num, CHARSET_INFO *cs) { return set_int((longlong)num, true, cs); }
|
||||
bool set_real(double num,uint decimals, CHARSET_INFO *cs);
|
||||
|
||||
/* Move handling of buffer from some other object to String */
|
||||
void reassociate(char *ptr_arg, uint32 length_arg, uint32 alloced_length_arg,
|
||||
CHARSET_INFO *cs)
|
||||
/* Take over handling of buffer from some other object */
|
||||
void reset(char *ptr_arg, uint32 length_arg, uint32 alloced_length_arg,
|
||||
CHARSET_INFO *cs)
|
||||
{
|
||||
free();
|
||||
Ptr= ptr_arg;
|
||||
@ -269,6 +269,15 @@ public:
|
||||
alloced= ptr_arg != 0;
|
||||
}
|
||||
|
||||
/* Forget about the buffer, let some other object handle it */
|
||||
char *release()
|
||||
{
|
||||
char *old= Ptr;
|
||||
Ptr=0; str_length= Alloced_length= extra_alloc= 0;
|
||||
alloced= thread_specific= 0;
|
||||
return old;
|
||||
}
|
||||
|
||||
/*
|
||||
PMG 2004.11.12
|
||||
This is a method that works the same as perl's "chop". It simply
|
||||
|
Reference in New Issue
Block a user