~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mystrings/longlong2str.c

  • Committer: Mats Kindahl
  • Date: 2008-08-26 07:32:59 UTC
  • mto: (489.1.2 codestyle)
  • mto: This revision was merged to the branch mainline in revision 491.
  • Revision ID: mats@mysql.com-20080826073259-9k4evtajgldgolli
Replaced use of thd_proc_info() macro with calls to
set_proc_info() and get_proc_info() internally.  Introduced
functions set_thd_proc_info() and get_thd_proc_info() for
external users, i.e., plug-ins.

The set_thd_proc_info() accepted callers info that can be used to
print debug output, but the information was not used. The return
value was changed to void and the old value is not fetched any
more. To be able to get the value of proc_info for external
users, the function get_thd_proc_info() was introduced.

The thd_proc_info() macro called set_thd_proc_info() but almost
never used the return value of set_thd_proc_info() so the macro
was replaced with a call of THD::set_proc_info().

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
   You should have received a copy of the GNU General Public License
13
13
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
 
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
16
/*
17
17
  Defines: int64_t2str();
20
20
  converts the (int64_t) integer "val" to character form and moves it to
21
21
  the destination string "dst" followed by a terminating NUL.  The
22
22
  result is normally a pointer to this NUL character, but if the radix
23
 
  is dud the result will be NULL and nothing will be changed.
 
23
  is dud the result will be NullS and nothing will be changed.
24
24
 
25
25
  If radix is -2..-36, val is taken to be SIGNED.
26
26
  If radix is  2.. 36, val is taken to be UNSIGNED.
37
37
        itoa assumes that 10 -base numbers are allways signed and other arn't.
38
38
*/
39
39
 
40
 
#include "config.h"
41
 
 
42
40
#include "m_string.h"
43
41
 
44
 
namespace drizzled
45
 
{
46
 
namespace internal
47
 
{
48
 
 
49
42
#if !defined(int64_t2str) && !defined(HAVE_LONGLONG2STR)
50
43
 
51
 
char _dig_vec_upper[] =
52
 
  "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
53
 
 
54
44
/*
55
45
  This assumes that int64_t multiplication is faster than int64_t division.
56
46
*/
87
77
 
88
78
  while (uval > (uint64_t) LONG_MAX)
89
79
  {
90
 
    uint64_t quo= uval/(uint32_t) radix;
91
 
    uint32_t rem= (uint32_t) (uval- quo* (uint32_t) radix);
 
80
    uint64_t quo= uval/(uint) radix;
 
81
    uint rem= (uint) (uval- quo* (uint) radix);
92
82
    *--p = _dig_vec_upper[rem];
93
83
    uval= quo;
94
84
  }
96
86
  while (long_val != 0)
97
87
  {
98
88
    long quo= long_val/radix;
99
 
    *--p = _dig_vec_upper[(unsigned char) (long_val - quo*radix)];
 
89
    *--p = _dig_vec_upper[(uchar) (long_val - quo*radix)];
100
90
    long_val= quo;
101
91
  }
102
92
  while ((*dst++ = *p++) != 0) ;
134
124
 
135
125
  while (uval > (uint64_t) LONG_MAX)
136
126
  {
137
 
    uint64_t quo= uval/(uint32_t) 10;
138
 
    uint32_t rem= (uint32_t) (uval- quo* (uint32_t) 10);
 
127
    uint64_t quo= uval/(uint) 10;
 
128
    uint rem= (uint) (uval- quo* (uint) 10);
139
129
    *--p = _dig_vec_upper[rem];
140
130
    uval= quo;
141
131
  }
143
133
  while (long_val != 0)
144
134
  {
145
135
    long quo= long_val/10;
146
 
    *--p = _dig_vec_upper[(unsigned char) (long_val - quo*10)];
 
136
    *--p = _dig_vec_upper[(uchar) (long_val - quo*10)];
147
137
    long_val= quo;
148
138
  }
149
139
  while ((*dst++ = *p++) != 0) ;
150
140
  return dst-1;
151
141
}
152
142
#endif
153
 
 
154
 
} /* namespace internal */
155
 
} /* namespace drizzled */