-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Trivial - P5
-
None
-
Affects Version/s: None
-
Component/s: None
-
Storage Engines
Comments preceding a #define within a function are aligned to it. When in the middle of a function, we think it makes more sense to indent at the same level as the rest of the code block.
Here's an example below. The comment beginning with "If the size of the lock file" is outdented to be in line with theĀ #define.
if (bytelock) { /* * Lock a byte of the file: if we don't get the lock, some other process is holding it, * we're done. The file may be zero-length, and that's OK, the underlying call supports * locking past the end-of-file. */ if (__wt_file_lock(session, conn->lock_fh, true) != 0) WT_ERR_MSG(session, EBUSY, "WiredTiger database is already being managed by " "another process"); /* * If the size of the lock file is non-zero, we created it (or * won a locking race with the thread that created it, it * doesn't matter). * * Write something into the file, zero-length files make me * nervous. * * The test against the expected length is sheer paranoia (the * length should be 0 or correct), but it shouldn't hurt. */ #define WT_SINGLETHREAD_STRING "WiredTiger lock file\n" WT_ERR(__wt_filesize(session, conn->lock_fh, &size)); if ((size_t)size != strlen(WT_SINGLETHREAD_STRING)) WT_ERR(__wt_write(session, conn->lock_fh, (wt_off_t)0, strlen(WT_SINGLETHREAD_STRING), WT_SINGLETHREAD_STRING)); } /* We own the lock file, optionally create the WiredTiger file. */ ret = __wt_open( session, WT_WIREDTIGER, WT_FS_OPEN_FILE_TYPE_REGULAR, is_create ? WT_FS_OPEN_CREATE : 0, &fh);