MCPcopy Create free account
hub / github.com/apache/trafficserver / RecGetRecord_Xmalloc

Function RecGetRecord_Xmalloc

src/records/RecCore.cc:769–800  ·  view source on GitHub ↗

------------------------------------------------------------------------- RecGetRecord_Xmalloc -------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

767// RecGetRecord_Xmalloc
768//-------------------------------------------------------------------------
769RecErrT
770RecGetRecord_Xmalloc(const char *name, RecDataT data_type, RecData *data, bool lock)
771{
772 RecErrT err = REC_ERR_OKAY;
773
774 if (lock) {
775 ink_rwlock_rdlock(&g_records_rwlock);
776 }
777
778 if (auto it = g_records_ht.find(name); it != g_records_ht.end()) {
779 RecRecord *r = it->second;
780
781 rec_mutex_acquire(&(r->lock));
782 if (!r->registered || (r->data_type != data_type)) {
783 err = REC_ERR_FAIL;
784 } else {
785 // Clear the caller's record just in case it has trash in it.
786 // Passing trashy records to RecDataSet will cause confusion.
787 memset(data, 0, sizeof(RecData));
788 RecDataSet(data_type, data, &(r->data));
789 }
790 rec_mutex_release(&(r->lock));
791 } else {
792 err = REC_ERR_FAIL;
793 }
794
795 if (lock) {
796 ink_rwlock_unlock(&g_records_rwlock);
797 }
798
799 return err;
800}
801
802//-------------------------------------------------------------------------
803// RecForceInsert

Callers 6

RecGetRecordIntFunction · 0.85
RecGetRecordFloatFunction · 0.85
RecGetRecordCounterFunction · 0.85
RecGetRecordByteFunction · 0.85
RecGetRecordBoolFunction · 0.85

Calls 8

ink_rwlock_rdlockFunction · 0.85
rec_mutex_acquireFunction · 0.85
memsetFunction · 0.85
RecDataSetFunction · 0.85
rec_mutex_releaseFunction · 0.85
ink_rwlock_unlockFunction · 0.85
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected