Skip to content

Commit

Permalink
Merge pull request #754 from codesoap/master
Browse files Browse the repository at this point in the history
Improve readability of Backup()
  • Loading branch information
mattn committed Nov 5, 2019
2 parents c64f703 + 17bc447 commit 67c1376
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions backup.go
Expand Up @@ -25,18 +25,18 @@ type SQLiteBackup struct {
}

// Backup make backup from src to dest.
func (c *SQLiteConn) Backup(dest string, conn *SQLiteConn, src string) (*SQLiteBackup, error) {
func (destConn *SQLiteConn) Backup(dest string, srcConn *SQLiteConn, src string) (*SQLiteBackup, error) {
destptr := C.CString(dest)
defer C.free(unsafe.Pointer(destptr))
srcptr := C.CString(src)
defer C.free(unsafe.Pointer(srcptr))

if b := C.sqlite3_backup_init(c.db, destptr, conn.db, srcptr); b != nil {
if b := C.sqlite3_backup_init(destConn.db, destptr, srcConn.db, srcptr); b != nil {
bb := &SQLiteBackup{b: b}
runtime.SetFinalizer(bb, (*SQLiteBackup).Finish)
return bb, nil
}
return nil, c.lastError()
return nil, destConn.lastError()
}

// Step to backs up for one step. Calls the underlying `sqlite3_backup_step`
Expand Down

0 comments on commit 67c1376

Please sign in to comment.