~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/memcached_functions/memc_behavior_get.cc

  • Committer: Olaf van der Spek
  • Date: 2011-07-05 18:15:41 UTC
  • mto: This revision was merged to the branch mainline in revision 2384.
  • Revision ID: olafvdspek@gmail.com-20110705181541-t5gdqo5ilg64jac6
Use boost::to_upper

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
 
55
55
String *MemcachedBehaviorGet::val_str(String *str)
56
56
{
57
 
  memcached_behavior mbehavior;
58
 
  uint64_t isetting;
59
 
  map<const string, memcached_behavior>::iterator it;
60
57
  String *tmp_behavior;
61
58
 
62
59
  if (arg_count != 1 ||
67
64
    return &failure_buff;
68
65
  }
69
66
 
70
 
  string behavior(tmp_behavior->c_ptr());
71
 
 
72
67
  /*
73
68
   * We don't want the user to have to type in all input in upper
74
69
   * case so we transform the input strings to upper case here.
75
70
   */
76
 
  std::transform(behavior.begin(), behavior.end(),
77
 
                 behavior.begin(), ::toupper);
78
71
 
79
 
  it = behavior_map.find(behavior);
80
 
  if (it == behavior_map.end()) 
 
72
  memcached_behavior* it = find_ptr(behavior_map, boost::to_upper_copy(string(tmp_behavior->c_ptr())));
 
73
  if (not it) 
81
74
  {
82
75
    setFailureString("UNKNOWN BEHAVIOR TYPE!");
83
76
    return &failure_buff;
84
77
  }
85
78
        
86
 
  mbehavior= behavior_map[behavior];
 
79
  memcached_behavior mbehavior= *it;
87
80
 
88
 
  isetting= memcached_behavior_get(memc, mbehavior);
 
81
  uint64_t isetting= memcached_behavior_get(memc, mbehavior);
89
82
 
90
83
  switch (mbehavior)
91
84
  {