~fractalcat/gearmand/docfixes

« back to all changes in this revision

Viewing changes to libgearman/unique.cc

  • Committer: Brian Aker
  • Date: 2012-12-13 11:44:26 UTC
  • mto: (621.4.66 workspace)
  • mto: This revision was merged to the branch mainline in revision 676.
  • Revision ID: brian@tangent.org-20121213114426-lnrt6aysy7lqc01h
Adding support for deriving the unique value based on the data that is supplied by the client.

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
  return local;
45
45
}
46
46
 
47
 
size_t gearman_unique_size(gearman_unique_t *self)
48
 
{
49
 
  if (not self)
50
 
    return 0;
51
 
 
52
 
  return self->size;
 
47
size_t gearman_unique_size(gearman_unique_t *unique_)
 
48
{
 
49
  if (unique_)
 
50
  {
 
51
    return unique_->size;
 
52
  }
 
53
 
 
54
  return 0;
 
55
}
 
56
 
 
57
bool gearman_unique_is_hash(const gearman_unique_t& unique_)
 
58
{
 
59
  if (gearman_size(unique_) == 1)
 
60
  {
 
61
    if (gearman_c_str(unique_)[0] == '#')
 
62
    {
 
63
      return true;
 
64
    }
 
65
  }
 
66
 
 
67
  return false;
53
68
}