// Close frees native C resources func (ws *WordStemmer) Close() error { ws.mutex.Lock() defer ws.mutex.Unlock() if nil != ws.stemmer { C.sb_stemmer_delete(ws.stemmer) ws.stemmer = nil return nil } return fmt.Errorf("Cannot close: stemmer is not valid.") }
// internal method for GCing the C allocated stemmer func (s Stemmer) Close() { C.sb_stemmer_delete(s.stemmer) }
// free C resources func free(stmr *Stemmer) { if stmr.stmr != nil { C.sb_stemmer_delete(stmr.stmr) stmr.stmr = nil } }