~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to server/lock.cc

  • Committer: Brian Aker
  • Date: 2008-07-14 22:18:37 UTC
  • mfrom: (77.1.96 codestyle)
  • Revision ID: brian@tangent.org-20080714221837-oceoshx7fjkla9u3
Merge from Monty

Show diffs side-by-side

added added

removed removed

Lines of Context:
74
74
*/
75
75
 
76
76
#include "mysql_priv.h"
77
 
#include <mysys/hash.h>
 
77
#include <hash.h>
78
78
#include <assert.h>
79
79
 
80
80
/**
131
131
  @param flags Lock flags
132
132
  @return 0 if all the check passed, non zero if a check failed.
133
133
*/
134
 
int mysql_lock_tables_check(THD *thd __attribute__((unused)),
 
134
int mysql_lock_tables_check(THD *thd __attribute__((__unused__)),
135
135
                            TABLE **tables, uint count,
136
 
                            uint flags __attribute__((unused)))
 
136
                            uint flags __attribute__((__unused__)))
137
137
{
138
138
  uint system_count;
139
139
  uint i;
514
514
        removed_locks= table->lock_count;
515
515
 
516
516
        /* Move down all table pointers above 'i'. */
517
 
        memcpy((char*) (locked->table+i),
518
 
               (char*) (locked->table+i+1),
519
 
               (old_tables - i) * sizeof(TABLE*));
 
517
        bmove((char*) (locked->table+i),
 
518
              (char*) (locked->table+i+1),
 
519
              (old_tables - i) * sizeof(TABLE*));
520
520
 
521
521
        lock_data_end= table->lock_data_start + table->lock_count;
522
522
        /* Move down all lock data pointers above 'table->lock_data_end-1' */
523
 
        memcpy((char*) (locked->locks + table->lock_data_start),
524
 
               (char*) (locked->locks + lock_data_end),
525
 
               (locked->lock_count - lock_data_end) *
526
 
               sizeof(THR_LOCK_DATA*));
 
523
        bmove((char*) (locked->locks + table->lock_data_start),
 
524
              (char*) (locked->locks + lock_data_end),
 
525
              (locked->lock_count - lock_data_end) *
 
526
              sizeof(THR_LOCK_DATA*));
527
527
 
528
528
        /*
529
529
          Fix moved table elements.
853
853
        return(0);
854
854
      }
855
855
    }
 
856
    THR_LOCK_DATA **org_locks = locks;
856
857
    locks_start= locks;
857
858
    locks= table->file->store_lock(thd, locks,
858
859
                                   (flags & GET_LOCK_UNLOCK) ? TL_IGNORE :
864
865
      table->lock_count=      (uint) (locks - locks_start);
865
866
    }
866
867
    *to++= table;
 
868
    if (locks)
 
869
      for ( ; org_locks != locks ; org_locks++)
 
870
        (*org_locks)->debug_print_param= (void *) table;
867
871
  }
868
872
  /*
869
873
    We do not use 'tables', because there are cases where store_lock()
1014
1018
}
1015
1019
 
1016
1020
 
1017
 
void unlock_table_name(THD *thd __attribute__((unused)),
 
1021
void unlock_table_name(THD *thd __attribute__((__unused__)),
1018
1022
                       TABLE_LIST *table_list)
1019
1023
{
1020
1024
  if (table_list->table)
1025
1029
}
1026
1030
 
1027
1031
 
1028
 
static bool locked_named_table(THD *thd __attribute__((unused)),
 
1032
static bool locked_named_table(THD *thd __attribute__((__unused__)),
1029
1033
                               TABLE_LIST *table_list)
1030
1034
{
1031
1035
  for (; table_list ; table_list=table_list->next_local)