MCPcopy Create free account
hub / github.com/MariaDB/server / PROFILE_Close

Function PROFILE_Close

storage/connect/inihandl.cpp:568–609  ·  view source on GitHub ↗

* PROFILE_Close * * Flush the named profile to disk and remove it from the cache. ***********************************************************************/

Source from the content-addressed store, hash-verified

566 * Flush the named profile to disk and remove it from the cache.
567 ***********************************************************************/
568void PROFILE_Close(LPCSTR filename)
569{
570 int i;
571 BOOL close = FALSE;
572 struct stat buf;
573 PROFILE *tempProfile;
574
575 if (trace(2))
576 htrc("PROFILE_Close: CurProfile=%p N=%d\n", CurProfile, N_CACHED_PROFILES);
577
578 /* Check for a match */
579 for (i = 0; i < N_CACHED_PROFILES; i++) {
580 if (trace(2))
581 htrc("MRU=%s i=%d\n", SVP(MRUProfile[i]->filename), i);
582
583 if (MRUProfile[i]->filename && !strcmp(filename, MRUProfile[i]->filename)) {
584 if (i) {
585 /* Make the profile to close current */
586 tempProfile = MRUProfile[i];
587 MRUProfile[i] = MRUProfile[0];
588 MRUProfile[0] = tempProfile;
589 CurProfile=tempProfile;
590 } // endif i
591
592 if (trace(2)) {
593 if (!stat(CurProfile->filename, &buf) && CurProfile->mtime == buf.st_mtime)
594 htrc("(%s): already opened (mru=%d)\n", filename, i);
595 else
596 htrc("(%s): already opened, needs refreshing (mru=%d)\n", filename, i);
597
598 } // endif trace
599
600 close = TRUE;
601 break;
602 } // endif filename
603
604 } // endfor i
605
606 if (close)
607 PROFILE_ReleaseFile();
608
609} // end of PROFILE_Close
610
611
612/***********************************************************************

Callers 1

CloseDBMethod · 0.85

Calls 3

PROFILE_ReleaseFileFunction · 0.85
htrcFunction · 0.70
statClass · 0.70

Tested by

no test coverage detected